sub infix:<!~> { say @_ }; 3 !~ 4
Prints [3 4].
Exits with the following error: Unsupported use of !~ to do negated pattern matching; in Perl 6 please use !~~.
This also happens with =~, <<, >>, and possibly others.
This is Rakudo version 2017.09 built on MoarVM version 2017.09.1
implementing Perl 6.c.
There's a bunch more ops and some things that are perfectly fine Rakudo code, but it gets complained like I'm a $language programmer who made a mistake:
$ perl6 -e '{ $^A }(42)'
===SORRY!=== Error while compiling -e
Unsupported use of $^A variable; in Perl 6 please use Form module
at -e:1
------> { $^A⏏ }(42)
$ perl6 -e '$/ = "x"'
===SORRY!=== Error while compiling -e
Unsupported use of $/ variable; in Perl 6 please use the filehandle's .nl-in attribute
at -e:1
------> $/⏏ = "x"
$ perl6 -e 'my $n = new class {}:'
===SORRY!=== Error while compiling -e
Unsupported use of C++ constructor syntax; in Perl 6 please use method call syntax
at -e:1
------> my $n = new class ⏏{}:
All these things are really annoying because they introduce conditions where normally-valid code is arbitrarily made invalid just because it's some construct in some language. The last one is especially annoying because I haven't written a single line of C++ code in my life. IMO all these errors should be disableable with a pragma, or better yet disabled by default and only enabled with some pragma; e.g. use beginner::helpers; Some argue for more verbose errors and IMO the extended errors could be stuffed under the same pragma.
Wondering how Perl 6 implements user-defined ops ( >_<
The magic happens here: https://github.com/rakudo/rakudo/blob/e9351cbaa961c4d1e4ef8b4cb52418d55766a8d6/src/Perl6/Grammar.nqp#L4804-L5036
Same as how'd you define a slang: you just mix in a role into grammar and actions
This is still an issue in the latest version. Is it an LTA error message? Or is it a bug?
Most helpful comment
There's a bunch more ops and some things that are perfectly fine Rakudo code, but it gets complained like I'm a
$languageprogrammer who made a mistake:All these things are really annoying because they introduce conditions where normally-valid code is arbitrarily made invalid just because it's some construct in some language. The last one is especially annoying because I haven't written a single line of C++ code in my life. IMO all these errors should be disableable with a pragma, or better yet disabled by default and only enabled with some pragma; e.g.
use beginner::helpers;Some argue for more verbose errors and IMO the extended errors could be stuffed under the same pragma.