You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normal user defined subs persist between calls. If I declare sub a {}, a()works as the next command. This does not work for operators. If a is a infix, the next command will not have a definition for a at all.
Expected Behavior
For custom operators to last between commands. Since other state lasts between commands like this, I would expect for operators to last as well.
Actual Behavior
Custom operators are forgotten for each new command.
Steps to Reproduce
user[~]$perl6
To exit type 'exit' or '^D'
> sub infix:<bb> {$^a + $^b}; 2 bb 2
4
> sub infix:<bb> {$^a + $^b};
sub infix:<bb> ($a, $b) { #`(Sub+{Precedence}|94152335641936) ... }
> 2 bb 2
===SORRY!=== Error while compiling:
Two terms in a row
------> 2⏏ bb 2
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier loop
Environment
Operating system: Debian 6.3
Compiler version (perl6 -v):
This is Rakudo version 2018.06 built on MoarVM version 2018.06
implementing Perl 6.c.
I also reproduced the same problem on a few weeks old recent development build which output this for perl -v:
This is Rakudo version 2018.06-449-gec366c30d built on MoarVM version 2018.06-425-g0daf99bcb
implementing Perl 6.c.
The text was updated successfully, but these errors were encountered:
Same as RT#131900. Grammar mutations don't persist in REPL.
zoffixznet
changed the title
In REPL, user defined oporators do not persist between lines oporator
In REPL, user defined operators do not persist between lines operator
Sep 5, 2018
Updating $!compiler : $compiler.parsegrammar($lang.slang_grammar('MAIN')) at each loop.
Would I make the same PR here ? Extracting information from the "sandbox" with a dynamic variable also ? We still have troubles with pragma persistence, details in this issue.
The Problem
Normal user defined subs persist between calls. If I declare
sub a {}
,a()
works as the next command. This does not work for operators. Ifa
is a infix, the next command will not have a definition fora
at all.Expected Behavior
For custom operators to last between commands. Since other state lasts between commands like this, I would expect for operators to last as well.
Actual Behavior
Custom operators are forgotten for each new command.
Steps to Reproduce
Environment
perl6 -v
):I also reproduced the same problem on a few weeks old recent development build which output this for
perl -v
:The text was updated successfully, but these errors were encountered: