On Tue, 2004-04-13 at 11:16, Thomas A. Boyer wrote:
> Here is the relevant paragraph from the apocalypse:
> I hereby declare that a |package| declaration at the front of a
> file unambiguously indicates you are parsing Perl 5 code. If
> you want to write a Perl 6 module or class, it'll start with
> the keyword |module| or |class|. I don't know yet what the exact
> syntax of a module or a class declaration will be, but one
> thing I do know is that it'll set the current global namespace
> much like a |package| declaration does.
So, there are many ways that Perl 6 could tell. Here's a pseudo-code
(because I don't fully know what Perl 6 will look like yet) example that
is disambiguated in many ways:
#!/usr/bin/perl6
# Use binary "perl6" which defaults to Perl 6 instead of Perl 5.
# This is easy, costs us nothing and does not affect Perl 5
use 6; # Force Perl 6 mode, no need for "no 6" in Perl 5,
# as Perl 6 can safely read "use 5" as "force Perl 5 mode"
class myprog { # encapsulate my program as a class Java-style
# Might need some kind of property to force mainishness
method main([EMAIL PROTECTED]) {
print "Hello world\n";
}
}
Or, if you prefer Perl 5 style:
#!/usr/bin/perl6
use 6;
class null {} # Just for the keyword
print "Hello world\n";
Or, if you prefer C style:
#!/usr/bin/perl6
use 6;
stdout.print("Hello world\n"); # not sure if the invocant will do it
--
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback