Since Perl6 will treat any code as "old code" unless it starts with one of the new keywords...
That's not quite right. Perl 6 will treat code as Perl 5 code if (and only if) the first executable line in the program is a package statement.
And, yes, we're going to need some way to distinguish Perl 6 code from Perl 5 code. Because there are a few simple cases that mean completely different things in Perl 5 and Perl 6. For example:
print $hash{bang};
In Perl 5 that means: print the value of the entry of %hash whose key is "bang".
In Perl 6 that means: print the value of the entry of the hash referred to by $hash whose key is "bang".
How could we distinguish Perl 5 and Perl 6 code? I'd suggest we add a <code6> flag and have the monastery render code marked as Perl 6 in a different font. For example, the submission:
We're going to need some way to distinguish:
<code>
print $hash{bang}; # entry 'bang' of hash %hash
</code>
from:
<code6>
print $hash{bang}; # entry 'bang' of hash %{$hash}
</code6>
might be rendered:
We're going to need some way to distinguish:
print $hash{bang}; # entry 'bang' of hash %hash
from:
print $hash{bang}; # entry 'bang' of hash %{$hash}
Note: I've used a red-shift/blue-shift visual pun here, but in reality we'd need to use distinct font faces -- perhaps serif for Perl 5 and sans-serif for Perl 6 -- so as not to disadvantage those with impaired colour vision.
Using a separate mark-up tag would also support those monks who (through necessity or by choice) use a non-visual browser.
|