Closed p6rt closed 10 years ago
TimToady pointed out that my work on converting [] and {} accesses to sub calls, rather than method calls, had one more casualty:
*[0]([1, 2, 3])
This is tested in t/spec/S02-types/whatever.t, line 252 and currently fudged.
The suggested change in whatever_curry did not give the right result. And now I'm in here over my head, so I'm submitting a bug report as promised.
[18:53:51] \
On Thu Sep 26 11:17:22 2013, elizabeth wrote:
TimToady pointed out that my work on converting [] and {} accesses to sub calls, rather than method calls, had one more casualty:
*[0]([1, 2, 3])
This is tested in t/spec/S02-types/whatever.t, line 252 and currently fudged.
Works now:
$ perl6 -e'say *[0]([1, 2, 3])' 1
The suggested change in whatever_curry did not give the right result. And now I'm in here over my head, so I'm submitting a bug report as promised.
Liz
[18:53:51] \
lizmat: did you notice that the subscripting change broke *.[], *.\<>, and *.{} [18:54:21] \ TimToady: no, don't think so [18:54:55] \ I fudged a number of tests, but I don't recall fudging any .[] related tests [18:54:56] \ nr: my @a = [1,2,3],[4,5,6],[7,8,9]; say @a.map: *.[2] [18:54:59] \ niecza v24-95-ga6d4c5f: OUTPUT«3 6 9» [18:55:00] \ ..rakudo 50a57d: OUTPUT«Index out of range. Is: 2, should be in 0..0 in method \ at src/gen/CORE.setting:11768 in any at src/gen/Metamodel.nqp:2671 in any find_method_fallback at src/gen/Metamodel.nqp:2659 in any find_method at src/gen/Metamodel.nqp:946 in method reify…» [19:09:11] \ jnthn: I'm not sure how to fix .[] etc., any pointers ? [19:11:03] \ aaahhhhh… I completely missed that TimToady meant Whatever.[] [19:11:16] \ yes, that broke: simplest case [19:11:37] \ nr say *[0](1,2,3) [19:11:42] \ nr: say *[0](1,2,3) [19:11:45] \ niecza v24-95-ga6d4c5f: OUTPUT«Unhandled exception: Excess arguments to ANON, used 1 of 3 positionals at /tmp/GbWfbqMj6Y line 0 (ANON @ 1)  at /tmp/GbWfbqMj6Y line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 4583 (ANON @ 3)  at /home/p6eval/niecza/lib/CORE…» [19:11:45] \ ..rakudo 50a57d: OUTPUT«No such method 'postcircumfix:\<( )>' for invocant of type 'Whatever' in block at /tmp/IcpYdTyvhm:1» [19:12:04] \ lizmat: yeah [19:12:10] \ lizmat: See Actions.pm, whatever_curry [19:12:16] lizmat checks [19:12:31] \ lizmat: Near the top it OKs infix, prefix and postfix. Try adding postcircumfix to that list. [19:13:36] \ I guess I should follow the callmethod value, right? [19:14:13] \ ? [19:14:25] \ no, inside whatever_curry [19:14:38] \ (nqp::index($past.name, '&infix:') == 0 || [19:14:38] \ nqp::index($past.name, '&prefix:') == 0 || [19:14:38] \ nqp::index($past.name, '&postfix:') == 0 || [19:14:42] \ ahhhh ok [19:14:42] \ After that [19:16:21] \ compiling and testing [19:19:26] \ using index to test for prefix bothers me, since it'll scan uselessly whenever it doesn't match [19:20:49] moritz waits for masak++ to construct a bug report that involves a variable named 'something&infix:bla' which shouldn't be treated as an infix, but is [19:21:11] \ :P [19:21:21] \ well, the == 0 prevents that, but it's just the waste that bothers me [19:24:07] \ it's like using a pile-driver to squash a bug, and after doing it 50 times, then checking to see if you were successful the first time [19:25:33] \ might still be faster than nqp::eq(nqp::substr($past.name, 0, nqp::chars('&infix:')), '&infix:') [19:25:38] \ and a smart index might even have set up Boyer-Moore tables on the assumption it was going to scan [19:26:18] \ sure would be nice if we could write Perl 6 in Perl 6 :) [19:27:11] \ then it's just /^ '&' [ in | pre | post 'circum'? ] fix ':' / :) [19:27:58] \ $ perl6 --ll-exception -e 'say *[0](1,2,3)' [19:27:58] \ Too many positional parameters passed; got 3 but expected 1 [19:28:30] \ full stack trace: https://gist.github.com/lizmat/6717575 [19:28:35] \ the error changed [19:28:54] \ but I have no idea where that code lives [19:29:40] \ lizmat: maybe look at the ast [19:30:38] \ lizmat: src/Perl6/Actions.nqp sez a recursive grep [19:33:00] \ sanity check: *[0](1,2,3,4,5) should return the first element of the (1,2,3,4,5) parcel, right ? [19:35:02] \ nr: say (1,2,3,4,5)[0] [19:35:05] \ rakudo 50a57d, niecza v24-95-ga6d4c5f: OUTPUT«1» [19:35:08] \ so it would seem [19:35:23] \ right *phew* [19:35:35] \ so *() has to be exempted from the postcirumfixes for * [19:36:05] \ unless we force people to say (*[0])(1,2,3,45) [19:36:16] \ trying that [19:36:18] \ if we decide there's a use case for *.() [19:36:32] \ which arguably there probably is [19:36:55] \ map: *.() should invoke each of a list of invokables [19:37:23] \ so I'm inclined to not make *() an exception, and force people to say (*[0])(1,2,3,4,5) if that's what they mean [19:38:06] \ in that case, *[0](1,2,3,4,5) means { $_.[0].(1,2,3,4,5) } (as a WhateverCode) [19:38:17] \ that feels cleaner to me [19:38:43] \ the use case for callinging a WhateverCode directly is minimal [19:38:50] \ *inginging [19:39:14] lizmat feels she no longer has to duck [19:39:36] \ nr: say *[0](1,2,3,4,5).WHAT [19:39:36] \ as in: this is way over my head [19:39:38] \ niecza v24-95-ga6d4c5f: OUTPUT«Unhandled exception: Excess arguments to ANON, used 1 of 5 positionals at /tmp/vU2WHEK3m3 line 0 (ANON @ 1)  at /tmp/vU2WHEK3m3 line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 4583 (ANON @ 3)  at /home/p6eval/niecza/lib/CORE…» [19:39:39] \ ..rakudo 50a57d: OUTPUT«No such method 'postcircumfix:\<( )>' for invocant of type 'Whatever' in block at /tmp/uP5CQeMuln:1» [19:40:06] \ n: say (*[0](1,2,3,4,5)).WHAT [19:40:08] \ niecza v24-95-ga6d4c5f: OUTPUT«Unhandled exception: Excess arguments to ANON, used 1 of 5 positionals at /tmp/zSzO4DEzSC line 0 (ANON @ 1)  at /tmp/zSzO4DEzSC line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 4583 (ANON @ 3)  at /home/p6eval/niecza/lib/CORE…» [19:40:28] \ I guess niecza exempts .() though [19:41:07] \ n: say (*(1,2,3,4,5)).WHAT [19:41:09] \ niecza v24-95-ga6d4c5f: OUTPUT«Unhandled exception: Unable to resolve method postcircumfix:\<( )> in type Whatever at /tmp/JqJTGWQeaz line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 4583 (ANON @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 4584 (module-C…» [19:49:02] \ n: say ({.(1,2,3,4,5)}).WHAT [19:49:04] \ niecza v24-95-ga6d4c5f: OUTPUT«(Block)» [19:49:23] TimToady thinks *(1,2,3,4,5) should mean that [19:49:39] \ well, except it's a WhateverCode [19:51:15] \ TimToady: *(1,2,3,4,5) looks like -> &f { &f(1,2,3,4,5) } to me. [19:51:40] \ oh wait, we're saying the same thing, aren't we? [19:51:47] \ yes, though I just wrote it {.()} [19:52:36] \ so I flipflopped on my answer to lizmat++ and don't think .() should be an exception under Whatever [19:53:06] \ .oO( lalaalalalala I'm not listening ) :-) [19:53:49] \ but you BROKE it! WAAAH! :P [19:54:07] \ may I plead insanity ? [19:54:54] \ as long as you don't plead ultro-low- frequency EM [19:55:03] \ *ultra [19:55:17] \ My Hero! [19:55:55] \ but in that case someone needs to file a bug [19:56:16] \ .oO( I was suddenly reminded of http://en.wikipedia.org/wiki/My_Hero_(UK_TV_series) ) [19:57:08] TimToady looks around for an anti-hero to file the bug report for all the wrong reasons... [20:00:59] \ I will file one if I can't get it fixed
It seems most of this conversation is about the behaviour of *(). I think a different report should be filed for *.() or the title of this report be changed. As an aside, what curries into a WhateverCode should probably be written in the spec somewhere…
The RT System itself - Status changed from 'new' to 'open'
On Sat Apr 12 19:55:27 2014, Mouq wrote:
On Thu Sep 26 11:17:22 2013, elizabeth wrote:
TimToady pointed out that my work on converting [] and {} accesses to sub calls, rather than method calls, had one more casualty:
*[0]([1, 2, 3])
This is tested in t/spec/S02-types/whatever.t, line 252 and currently fudged.
Works now:
$ perl6 -e'say *[0]([1, 2, 3])' 1
[...] It seems most of this conversation is about the behaviour of *(). I think a different report should be filed for *.() or the title of this report be changed. As an aside, what curries into a WhateverCode should probably be written in the spec somewhere…
Since said test runs fine and is no longer fudged, I'm closing this ticket.
On Sat Apr 12 19:55:27 2014, Mouq wrote:
On Thu Sep 26 11:17:22 2013, elizabeth wrote:
TimToady pointed out that my work on converting [] and {} accesses to sub calls, rather than method calls, had one more casualty:
*[0]([1, 2, 3])
This is tested in t/spec/S02-types/whatever.t, line 252 and currently fudged.
Works now:
$ perl6 -e'say *[0]([1, 2, 3])' 1
[...] It seems most of this conversation is about the behaviour of *(). I think a different report should be filed for *.() or the title of this report be changed. As an aside, what curries into a WhateverCode should probably be written in the spec somewhere…
Since said test runs fine and is no longer fudged, I'm closing this ticket.
@usev6 - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#120025 (status was 'resolved')
Searchable as RT120025$