Skip Menu |
Report information
Id: 131099
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [LTA] is assoc('list') gives "MVMArray: Can't pop from an empty array"
On prefix and postfix ops, using `is assoc('list')` causes an LTA error without any location. I've no idea if it makes sense for them to be assoc list; originally, I came across this while trying to make a postfix op `is equiv(&[orelse])`: $ perl6 -e 'sub prefix:<♥> ($) is prec({:assoc("list")}) { }; ♥42' ===SORRY!=== MVMArray: Can't pop from an empty array $ perl6 -e 'sub postfix:<♥> ($) is prec({:assoc("list")}) { }; 42♥' ===SORRY!=== MVMArray: Can't pop from an empty array $ perl6 -e 'sub postfix:<♥> ($) is equiv(&[orelse]) { }; 42♥' ===SORRY!=== MVMArray: Can't pop from an empty array $ perl6 -v This is Rakudo version 2017.03-20-g027aa54 built on MoarVM version 2017.03-7-g029d121 implementing Perl 6.c. The error points to at gen/moar/stage2/NQPHLL.nqp:1099 (/home/zoffix/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:EXPR_reduce) However, I don't know if this should be fixed by throwing when attempting to is assoc list these types of ops or what...
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 2.1k
On Tue, 04 Apr 2017 11:05:05 -0700, cpan@zoffix.com wrote: Show quoted text
> On prefix and postfix ops, using `is assoc('list')` causes an LTA > error without any location. > > I've no idea if it makes sense for them to be assoc list; originally, > I came across this while trying to make a postfix op `is > equiv(&[orelse])`: > > $ perl6 -e 'sub prefix:<♥> ($) is prec({:assoc("list")}) { }; ♥42' > ===SORRY!=== > MVMArray: Can't pop from an empty array > > $ perl6 -e 'sub postfix:<♥> ($) is prec({:assoc("list")}) { }; 42♥' > ===SORRY!=== > MVMArray: Can't pop from an empty array > > $ perl6 -e 'sub postfix:<♥> ($) is equiv(&[orelse]) { }; 42♥' > ===SORRY!=== > MVMArray: Can't pop from an empty array > > $ perl6 -v > This is Rakudo version 2017.03-20-g027aa54 built on MoarVM version > 2017.03-7-g029d121 > implementing Perl 6.c. > > The error points to at gen/moar/stage2/NQPHLL.nqp:1099 > (/home/zoffix/.rakudobrew/moar- > nom/install/share/nqp/lib/NQPHLL.moarvm:EXPR_reduce) > > However, I don't know if this should be fixed by throwing when > attempting to is assoc list these types of ops or what...
This is partially fixed now for `is equiv` with https://github.com/rakudo/rakudo/commit/f9f0883c6c and https://github.com/perl6/roast/commit/75f42755ec Per TimToady[^1], we should throw on attempts to use list assoc with non-infix ops. It's a trivial thing to do with normal code, but because a lot of the setting isn't available in traits, it kept giving me compilation issues. There's one way that works, but in that method the check is done AFTER altering the prec (with .prec('assoc') eq... check), which IMO is LTA. I ended up hacking an nqp way with nqp::atkey(%spec) working, but then crashing with `:prec(:assoc<list>)` usage. So, I ended up with this NQP monstrocity: https://gist.github.com/zoffixznet/a68ba013efd5b424ae60734f1da5daaf along with fixing is equiv, is tighter, and is looser to just pass the <prec> key and not all the rest. It gave me a compilation error the 100th time today, so I stashed it and will give it another try another day; unless someone else beats me to it. [1] https://irclog.perlgeek.de/perl6-dev/2017-04-04#i_14375115


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org