Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't new operator definitions persist in the Perl 6 REPL?

I was having issues experimenting with defining operators on the Perl 6 REPL, and noticed that they do work, but only when used on the same line as they are defined. Why is this the case?

> sub postfix:<!>(Int $x where { $x >= 0 }) { [*] 1..$x }; 6!;
720
> 6!;
===SORRY!=== Error while compiling:
Negation metaoperator not followed by valid infix
------> 6!⏏;
    expecting any of:
        infix
        infix stopper
like image 315
Daniel Mita Avatar asked Aug 17 '18 13:08

Daniel Mita


1 Answers

It's a bug.

See bug reports Perl6 REPL forgets the definition of ... and REPL issue defining new operator... for more details.

like image 102
raiph Avatar answered Oct 28 '22 18:10

raiph