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

Owner: Nobody
Requestors: amkhlv [at] gmail.com
Cc:
AdminCc:

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



Date: Wed, 07 Jun 2017 15:22:26 -0300
From: Andrei Mikhailov <a.mkhlv [...] gmail.com>
Subject: [BUG] Perl6 REPL forgets the definition of infix sub
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 458b
This is Rakudo version 2017.04.3-292-ga61746fed built on MoarVM version 2017.04-68-g5f233249 implementing Perl 6.c. Executing the command "perl6" starts the normal REPL environment. In the first line I define: sub infix:<w> { $^a + $^b } and press ENTER. Then, in the next line: 1 w 2 ===SORRY!=== Error while compiling: Two terms in a row ------> say 1⏏ w 2 It seems that REPL forgets the definitions of infix subs. This only happens with infix.
Download (untitled) / with headers
text/plain 486b
Show quoted text
> It seems that REPL forgets the definitions of infix subs. This only > happens with infix.
Looks like this happens with at least postfix and postcircumfix, too: Show quoted text
> sub postfix:<plus>($a) { $a + 99 }; say 3plus;
102 Show quoted text
> 3plus;
===SORRY!=== Error while compiling: Confused ------> 3⏏plus; expecting any of: whitespace Show quoted text
> sub postcircumfix:<[[ ]]>($a,$b) { $a + $b }; 1[[2]]
3 Show quoted text
> 1[[2]]
Index out of range. Is: 2, should be in 0..0 in block <unit> at <unknown file> line 1
Download (untitled) / with headers
text/plain 303b
I've written this snippet to help diagnose the issue: https://gist.github.com/bduggan/cd2da7ac41da9bdadca4ee80d5e61ce1 (also attached) This demonstrates the behavior of the internal REPL. I'm not sure where to go from here. It looks like somehow modifications to the grammar need to be preserved.
Subject: bug.p6
Download bug.p6
application/octet-stream 684b

Message body not shown because it is not plain text.



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