Paul Johnson <[EMAIL PROTECTED]> writes:

> On Sat, Apr 14, 2001 at 12:11:12PM -0400, John Porter wrote:
> > Dan Sugalski wrote:
> > > I personally would rather that perl 6 handle perl 6 code only, and leave 
> > > the compilation and interpretation of perl 5 code to perl 5. 
> > 
> > FWIW, I agree 100% with Dan.
> 
> I'm curious to see how mutt will handle this thread when it gets off the
> right hand side of the screen, so would it be possible to have another
> couple of rounds of this?
> 
> For those who aren't quite sure of the rules, post one of these messages
> at the appropriate time:
> 
>  - Larry said perl6 will parse perl5 code by default.
>  - I don't want to have to put "module" in my one liners.
>  - Let's have a switch -6.
>  - What's wrong with -M6?
>  - Just use the shebang line.
>  - Can't perl determine whether it's perl5 or perl6?
>  - perl6 should parse perl6 by default.
> 
> Improvisation and embellishment is allowed, but don't get too far off
> the beaten track or people won't be sure which message they should post
> next and then the thread will die.

OK, I'm game...

Larry said perl6 will parse perl5 code by default.

He said this for the benefit of legacy perl5 code that we -can't- fix,
due to it being embedded in old shell scripts, etc, that we can't
expect people to hunt down and fix.  One-liners would be the hardest
hit by this, because they could be anywhere and changes in the
semantics of legal perl5 code when executed as perl6 code could cause
random breakage all over the place.

So /usr/bin/perl MUST assume that it is being fed perl5 code unless it
can explicitly tell otherwise.

Larry said that the official way to tell that perl code will be perl6
is by using a "module" keyword, which is otherwise identical to the
existing "package" keyword.  That captures most of the modules, but it
doesn't capture the main scripts -- which would be assumed to be perl5
unless something happens.

IF WE CAN MIX-AND-MATCH perl5 and perl6 scripts and modules, then I
don't see a big problem with assuming perl5 code unless

a) the code has a "module" declaration;
b) the code has "use 6";
c) the interpreter is called with -M6

I think we have to allow such mix-and-matching, because it is entirely
possible that a bit of legacy perl5 code may have a "use Foo;"
statement, and if foo is now perl6 code, we have to treat the main
script as perl5 and the module as perl6.

We could, I guess, restart the parsing as perl6 as soon as we run
across a perl6-specific feature (thus ensuring that the code is not
perl5 code), but what about code which is syntactically correct perl5
and perl6 code, but with different semantics (due to the differences
in how perl5 and perl6 handle IO, for instance)?  What do we do then?

 
> [ :-) for those who like such things ]
> 
> -- 
> Paul Johnson - [EMAIL PROTECTED]
> http://www.pjcj.net

Reply via email to