Hi monks,

Recently I've been messing around with Pugs and Perl 6. AFAIK, Perl6 is not only an upgrade of Perl5, but a new language that starts from Perl 5 but that has a (notably) modified syntax and a bunch of new features. Like Corion said recently: The main thing wrong with Perl 6 is the name. It poses as a version upgrade like from Perl 4 to Perl 5, but it's a completely different language with largely incompatible syntax.

(For those that are not familiar with Perl 6 syntax, here is a small example of code extracted from Perl 6 documentation:)

#Example1 use v6-alpha; method render ($x=1,$y=1,$z=0){ for @.filter (@.items){ say .draw (:$x, :$y, :$z); } } #Example2 class Dog is Mammal does Pet { my $.count where 0..*; has $!brain; has &.vocalize = &say; has $.name is rw = "fido"; has $.fur handles Groomable; has $.tail handles <wag hang>; method owner () handles s/^owner_// {...}

More examples can be found in the Perl 6 cookbook

In this thread there is an interesting discussion about Perl 6

I noticed in the documentation that one can mix Perl 5 and Perl 6 code in the same script, for example:

use v6-alpha; # ...some Perl 6 code... { use v5; # ...some Perl 5 code... { use v6-alpha; # ...more Perl 6 code... } }

Or even use Perl 5 modules in Perl 6 scripts, like:

use v6-alpha; use perl5:DBI; use perl5:Template ... ## Rest of Perl6 code

Does this mean that all the modules available from CPAN for Perl 5 will be available for Perl 6 too without modification? This seems great for those of us that already know Perl 5, but if this is the case, when Perl 6 becomes available, those who are new to Perl and want to learn it, will have to learn 2 different languages instead of only 1 (Perl 5 + Perl 6), or they won't be able to understand all the Perl 5 stuff that is already done (and still in use in Perl 6 scripts). Am I completely wrong?

Surely, mixing Perl 5 and Perl 6 code will be a nice thing for those who already use Perl 5. But won't be a mess for those learning the basics of Perl? (I'm afraid we will have to explain many (more) times the difference between $var[0] and @var[0])

citromatik


In reply to Perl 5 <-> Perl 6 compatibility: a benefit or a mess? by citromatik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.