13

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
Pat
  • 36,282
  • 18
  • 72
  • 87
Daniel Mita
  • 512
  • 2
  • 9

1 Answers1

9

It's a bug.

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

raiph
  • 31,607
  • 3
  • 62
  • 111