Lets try that again, since I think you parsed my email in a way I
didn't intend (and its at least 50% my fault)

----------

In my opinion, starting a script with "#!/usr/bin/perl6" should force
the interpreter to treat it like Perl 6, and if it does anything else
that's just ugly. Similarly, starting a script with "#!/usr/bin/perl5"
should force the interpreter to treat it like Perl 5, and if it does
anything else that's just ugly, too. The only opportunity for
ambiguity is if the script starts with "#!/usr/bin/perl" or no shebang
line.

In that case, maximal backward compatibility dictates that the
interpreter expect Perl 5, although 20 years from now we may wish
Perl 6 was assumed (and maybe by Perl 7 we will assume Perl 6 unless
told otherwise... :)

Personally, I view Perl 6 as such a completely new language (although
still Perlish in spirit, it is very different in other respects), that
I would be perfectly happy to be required to start all my Perl 6
programs with "#!/usr/bin/perl6" instead of "#!/usr/bin/perl", just
the same as I'd start a Python program with "#!/usr/bin/python".

If it turns out that the /usr/bin/perl program is actually just a link
to the same executable as /usr/bin/perl6 but operating with a different
personality, I'm fine with that. Heck, I'd be fine with /usr/bin/python
being a symlink to the same executable, too, and I'd expect it to behave
like a Python interpreter.

I don't see any need to have a program start out as a potentially Perl 5
program and then determine that it should really be thought of as Perl 6
and switch personalities. That is, I don't see a need for this:

  #!/usr/bin/perl
  use 6;

Since there is no version 6 of the Perl (5) language. Inline::Perl6
aside, there ain't no Perl 6 in the Perl 5 world, even though there are
a few Perl6:: isms.

Now, I do think it would be perfectly fine for a program to start off
as a Perl 6 program and have an embedded chunk that is interpreted as
Perl 5, since that is a feature of Perl 6.

  #!/usr/bin/perl6

  ... # Perl 6 stuff here

  use 5; # or, whatever

  # Perl 5 stuff here

  no 5; # or, whatever

  # More Perl 6 stuff here

  use python; # you get the idea

  ...


Regards,


-- Gregor

On Wed, 2004-04-14 at 12:59, Aaron Sherman wrote:
> On Wed, 2004-04-14 at 09:29, Gregor N. Purdy wrote:
> > So, we are moving in a more verbose direction, which is a bummer for
> > people who like to write one-liners and other tiny programs.
> 
>         perl6 -i.bak -ple 'rule octet {\d{1,2}|<[01]>\d{2}|2[<[1-4]>\d|5<[1-5]>]} 
> s:g/\b<octet>\.<octet>\.<octet>\.<octet>\b/IP ADDR/;' *
> 
> No biggie.
> 
> > Assuming only Perl 6 is installed on your system, if your script
> > started with:
> > 
> >   #!/usr/bin/perl
> > 
> > all the stuff about trying to figure out what version you are using
> > would have to apply I suppose. But, if you used this, are we saying
> > you still have to do something else to ensure its treated as Perl 6?
> 
> Yes, because Perl 6 *is* Perl 5, when it wants to be.
> 
> >   #!/usr/bin/perl6
> > 
> > And, if you did this, you might have to do something else to ensure
> > it is treated as Perl 5?
> 
> Correct. If you *say* "perl6" and then want to *be* Perl 5, I'm not sure
> if a) you could not or b) you would have to throw in something like "use
> 5".
> 
> >   #!/usr/bin/perl5
> > 
> > that seems wrong.
> 
> Not sure why. That is just short-hand for:
> 
>         #!/usr/bin/perl
>         use 5;
>         
> I'm not sure, once again, what would happen if you said:
> 
>       use 5;
>       use 6;
> 
> Either it would give you an error (you really deserve it) or it would
> just switch back to Perl 6 mode... the problem arises when you ask,
> "what about anything that got parsed in between the two?" Yech.
-- 
Gregor Purdy                            [EMAIL PROTECTED]
Focus Research, Inc.               http://www.focusresearch.com/

Reply via email to