A few days ago I briefly discussed with Nicholas Clark (current perl 5.8
pumpking) about making perl5 code forward-compatible with perl6.  A
quick look through the mailing list archives didn't turn up anything
obvious, and I don't recall any mechanism being presented in any of the
Apocalypses, so ...

Perl 6, we are promised, will try to run "legacy" code unchanged.  How
will it spot such legacy code?  Doing this reliably is a hard problem,
but we can make it easier.  I suggest that people put:

  use perl5;

near the top of their perl programs, scripts and modules.  This would be
a clear indicator to the perl6 compiler that this is a perl5 program
without it having to do any complicated and error-prone heuristics.  And
it could be implemented really easily in perl5 with no changes to the
core at all:

package perl5;
"i don't do anything yet";

If such a null-op pragma were to go into the next perl 5.8.x release
people could start preparing their existing code for perl 6 right now.
Which is surely a Good Thing.  And of course if the pragma were to also
be available to download seperately from the CPAN people still using
older 5.x releases could still use it.

-- 
David Cantrell

Reply via email to