Skip Menu |
Report information
Id: 132711
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: comdog <brian.d.foy [at] gmail.com>
Cc:
AdminCc:

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



To: rakudobug [...] perl.org
From: brian d foy <brian.d.foy [...] gmail.com>
Date: Fri, 12 Jan 2018 02:40:04 -0500
Subject: [LTA] Stupidly using `is assoc` with unary prefix operator has an error message from the deep
Download (untitled) / with headers
text/plain 436b
I stupidly did this: sub prefix:<²> ( Int:D \m --> Int:D ) is assoc<right> { m ** m } put ²(²2); And got this error: ===SORRY!=== MVMArray: Can't pop from an empty array I figure that associativity doesn't make any sense for unary prefix operators but that error message is from pretty deep in the swamp. I'd rather have something like "Don't do stupid things that make no sense" sort of error.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 678b
On Thu, 11 Jan 2018 23:40:54 -0800, comdog wrote: Show quoted text
> I stupidly did this: > > sub prefix:<²> ( Int:D \m --> Int:D ) > is assoc<right> > { m ** m } > > put ²(²2); > > And got this error: > > ===SORRY!=== > MVMArray: Can't pop from an empty array > > I figure that associativity doesn't make any sense for unary prefix > operators but that error message is from pretty deep in the swamp. I'd > rather have something like "Don't do stupid things that make no sense" > sort of error.
This looks to be the same issue as RT#131099. It lists a potential fix that fails compilation: https://rt.perl.org/Ticket/Display.html?id=131099#txn-1455809
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 681b
On Fri, 12 Jan 2018 03:50:19 -0800, cpan@zoffix.com wrote: Show quoted text
> This looks to be the same issue as RT#131099. It lists a potential fix > that fails compilation: > https://rt.perl.org/Ticket/Display.html?id=131099#txn-1455809
The fix is to throw on attempt to use list assoc on non-infixes, but there're explosions with many other assocs; looks like anything that isn't unary. And we can't throw on those, because assoc is meant to be used to disambiguate between prefix/postfix that have same precedence. It explodes in EXPR parser when trying to pop from @termstack. That area is too hard for me right now, so I'm giving up on this ticket, in case anyone else wants to give a go...


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