Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Parrot Monks? (pirates)

by TheDamian (Priest)
on Jan 09, 2005 at 22:08 UTC ( #420755=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Parrot Monks? (pirates)
in thread Parrot Monks?

You're completely right about the need to differentiate which version of the language particular code is in...especially in the long transition period. Perhaps <code5>...</code5> and <code6>...</code6> tags (whose contents are displayed in different fonts) might be a good starting point.

And if these were used consistently then it would be a SMOP to have the monastery itself append [Perl 5] or [Perl 6] (or both) to node titles, depending on what kind of tags the node contains.

Oh, and Perl 6 is quite a bit more imminent than you think: our goal is to have a beta out this year.


Comment on Re^5: Parrot Monks? (pirates)
Select or Download Code
Re^6: Parrot Monks? (one ring)
by tye (Cardinal) on Jan 09, 2005 at 22:28 UTC

    I'd rather have the Perl language specify how you tell Perl 5 code from Perl 6 code so that the problem is solved all over the world instead of each place that shows Perl code trying to come up with their own inconsistent ways of doing so such that none of them will ever be very thoroughly applied.

    - tye        

      There are several defined ways of differentiating scripts as a whole. A minimal approach allows for a bare literal in void context at the beginning:
      5; print "I'm Perl 5 code\n";
      vs
      6; say "I'm Perl 6 code";
      Or if you want to make sure strictness is on, you use
      use 6.0;
      or
      module;
      Those are okay for the script as a whole, but I hate to think about what happens when people start cutting and pasting snippets. Certainly Perl 6 could disallow snippets starting with "5;", but Perl 5 would currently accept a "6;" unless you had warnings turned on. One could go with "5:" and "6:" instead, but that's a syntax error in Perl 5 currently.

      Of course, there's always the tried and true:

      print "I'm Perl 5 code\n"; # Perl 5
      vs
      say "I'm Perl 6 code"; # Perl 6
      But that doesn't help much with cut-and-paste errors...

        I don't expect Perl to be able to prevent people from pasting VB code into the middle of a Perl script. Neither do I require that Perl to be able to jump between versions of the language willy-nilly (though a limited version of such a feat wouldn't surprise me much). (:

        My point is to have a standard way for people to declare what language they are using and have that way make sense to both the Perl interpretter and to other humans reading their code. If a person cuts and pastes snippets, then they should cut'n'paste snippets of the same language (not an unreasonable requirement).

        I like "use 5;" and "use 6;" a lot because they are quite clear and will make sense to people who know very little about Perl 6 (and will work at the top of snippets to the point of complaining clearly, even with a lot of cut'n'pasting).

        I also like the various Perl6 ways of turning strictures on like "module;".

        It would be cool if "use strict;" also forced Perl 5 interpretation [since that isn't how you turn on strictures in Perl6, though I suspect "no strict qw(...)" still works there(?)]. This way, a huge volume of existing code will "just (continue to) work" and will also be automatically labeled as "this is Perl 5 code".

        - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://420755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-26 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (176 votes), past polls