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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |