http://www.perlmonks.org?node_id=420494


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

Perl 5 solutions will still be useful in Perl 6.

Maybe not. Module and algorithm advice will remain valid, but many people come looking for code snippets. Very basic things like the syntax will change in Perl 6. The elder monks will have no problem reading old and new code and telling them apart, but beginners will be confused if some nodes write  $a[3] and others  @a[3]. So it has to be made clear what version the node is talking about.

Of course, since Perl 6 is not exactly imminent, neither is this problem. (Things may be different with Parrot which is maturing faster).

Replies are listed 'Best First'.
Re^5: Parrot Monks? (pirates)
by TheDamian (Vicar) on Jan 09, 2005 at 22:08 UTC
    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.

      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...