One thing that bugs is that perl5 code could potentially run with perl6. Is there any mitigation for that?
"In exchange for breaking backwards compatibility, at least at the language level, Perl 6 offers plenty of high-powered language concepts that Perl 5 didn't support..."
e.g.
> say $#array;
===SORRY!=== Error while compiling <unknown file>
Unsupported use of $#variable; in Perl 6 please use @variable.end
and package foo;
===SORRY!=== Error while compiling <unknown file>
This appears to be Perl 5 code. If you intended it to be Perl 6 code, please use a Perl 6 style declaration like "unit package Foo;" or "unit module Foo;", or use the block form instead of the semicolon form.There are a lot more, too. Another example:
> 1 == 1 ? "sane" : "insane"
===SORRY!=== Error while compiling <unknown file>
Unsupported use of ? and : for the ternary conditional operator; in Perl 6 please use ?? and !!
at <unknown file>:1
Or: > loop(my $i = 0; $i < 10; $i++) { say $i }
===SORRY!===
Word 'loop' interpreted as 'loop()' function call; please use whitespace around the parens
at <unknown file>:1
Easily the nicest error reporting I've seen in a compiler.EDIT: this was completely wrong, see below.
This will give good error messages when trying to run your code with the wrong compiler.