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

perl5 vs perl6

by jbrugger (Parson)
on Jan 05, 2005 at 07:12 UTC ( #419535=perlquestion: print w/replies, xml ) Need Help??

jbrugger has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
recently i became more aware of the existance of the upcoming perl 6 and Parrot. I've read some flames about it why we might (not) want to use it, and i've seen some interesting nodes on perlmonks.

What i'm missing however, (not searched well enough?) is a good (and objective) chart whith the differences of these 2 languages, and some real pros and cons.

Anyone know of such a chart / paper?
What i also like to know if there is a mod_perl6 coming up etc. etc.

Replies are listed 'Best First'.
Re: perl5 vs perl6
by gaal (Parson) on Jan 05, 2005 at 07:28 UTC

    Perl6 is still some time off, and you will not have to use it, just like you do not have to use another language today. If you don't want to be the first one to try it out, that's understandable, but then you'd have to wait till someone else does. It would be hard to make a good chart like you want because perl6 doesn't exist yet, and these comparisons really make more sense after there's some experience with (both) the things they're comparing.

    Not a comparison, but a nice chart to look at: Mark Lentczner's Periodic Table of Perl6 Operators.

    There almost certainly will be an embedded perl module for apache. But who knows, maybe it'll be for a newer version of apache only :)

      Does a "Periodic Table of Perl5 Operators" exist?
        Not that I know. Interesting project idea, though, and its realization may be useful for comparisons such as the OP wants to make.
      It would be hard to make a good chart like you want because perl6 doesn't exist yet, and these comparisons really make more sense after there's some experience with (both) the things they're comparing.
      Totally true, i know. but since they're woring on perl6 an Parrot for quite some time now (since 2001?) i was hoping that someone alreaddy did.
Re: perl5 vs perl6
by dragonchild (Archbishop) on Jan 05, 2005 at 13:59 UTC
    These are the major basic differences that I have seen, in no particular order:
    • A lot of the little squirrely places will be cleaned up. (If you don't know them, don't worry. If you do, cheering is appropriate.)
    • OO programming is a forethought, not an afterthought. In particular, a lot of work has been done to enable various styles of OO programming.
    • Anyone will now be able to parse Perl, particularly in Perl.
    • Macros. Not C macros, but (almost) LISP macros. This means that anyone can create new Perl syntax without having to use source filters.
    • Continuations. While most solutions won't need these, those that do need them.
    • Perl will compile to Parrot opcodes.

    That last is the most important item. This means that any two languages that compile to Parrot will be able to use each other's code seamlessly. For example, let's say you really want to write some class in Ruby because Ruby r0x0rs the OO world. But, you really need to use it in this Python library you have already written. Oh, and now the boss wants you to take that Python library (using the Ruby class) and hook it into the webapp you wrote using Perl. Oh, and it has to communicate with the foobarbaz that has the Java client already working, but nothing else.

    Not a problem. :-)

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      Continuations. While most solutions won't need these, those that do need them.
      Well, since you brought up continuations, another item I feel like adding to my randomly selected list amongst the many randomly selectable ones is 'hypotheticals'. Perl6-ese for local is temp, so far nothing new. But there will be let as well, and it will behave like temp except that the value of the variable at the exit of scope will be retained or discarded in favour of the previous one according a condition. I'm not really sure about the exact syntax/semantics, sounds interesting though!!
      Perl will compile to Parrot opcodes.

      That last is the most important item. This means that any two languages that compile to Parrot will be able to use each other's code seamlessly.

      Not only!! It seems that Parrot will indeed be able to run natively bytecode for other virtual machines (this is rumored to be a side effect of the planned compatibility with a game-oriented VM).

        let is like temp but it's only useful inside of rules. If the rule succeeds, then the variable keeps the hypothesized value. If the rule fails, then the variable loses its hypothesized value and thus reverts back to whatever value it had before (if any).

        This is all as far as I know anyway. But then, things I thought I knew about rules have changed at least 2 times since I learned them, so who really knows anyway? ;-)

Re: perl5 vs perl6
by Thilosophy (Curate) on Jan 05, 2005 at 07:35 UTC
    What i also like to know if there is a mod_perl6 coming up etc. etc.

    For starters, there is an evolving mod_parrot, which will most likely become the foundation for a mod_perl6 (and hopefully also future versions of mod_php, mod_python, mod_ruby and so on) http://www.perl.com/pub/a/2004/12/22/mod_parrot.html

Re: perl5 vs perl6
by qq (Hermit) on Jan 05, 2005 at 11:10 UTC

    The apocalypses and synopses and exegeses often discuss perl6 in terms of the differences between perl5 and perl6. I don't think a simple chart would do it. Regardless, they are essential reading for perl6.

Re: perl5 vs perl6
by Eyck (Priest) on Jan 05, 2005 at 08:50 UTC

    For the community, the best course of action would be for as many people as possible to start using perl6.

    This would benefit everyone - perl6 would evolve and mature much faster, this would spurr maturation of parrot, and the whole situation would help pony to grow up and become a fine stallion.

    However, personal experience suggests that waiting and staying with perl5 is the best for your health ( physical, mental and probably financial)

      Ponie, for the uninitiated, is Perl 5 running on top of Parrot (the new internal engine for a Perl 6 and a number of other languages that will most likely be released before Perl 6).

      I expect Ponie to grow up and become a fine stallion (reach production quality) before Perl 6 does, so it will probably be Parrot and Ponie driving maturation of Perl 6 than the other way around. Which is a good thing, since Ponie should be able to run Perl5 code unmodified. And faster than current Perl. And with the ability to use code libraries from other Parrot languages (including Perl 6).

      Maybe we need a Perl 6 FAQ at PM. These Perl 6 questions keep coming up again and again and it's hard, especially for newbies, to find an easily understandable summary of the current status, what can already be known / learned / tried out, or if not, that they / we must wait. Like an official statement of one of the developers. Is there one?
        That would indeed be a great idea tmho. **** Update **** not that i really care, but why is it a 'bad' thing to agree to a suggestion? I don't understand.
Re: perl5 vs perl6
by blazar (Canon) on Jan 05, 2005 at 20:26 UTC
    recently i became more aware of the existance of the upcoming perl 6 and Parrot. I've read some flames about it why we might (not) want to use it, and i've seen some interesting nodes on perlmonks.
    Well, for one thing I wouldn't call it "upcoming".
    What i'm missing however, (not searched well enough?) is a good (and objective) chart whith the differences of these 2 languages, and some real pros and cons.
    There's not such a thing, and there can't be. The closest thing you can get are Apocalypses, Exegeses and Synopses. Be warned, though, that while Apocalypses are fixed for "historical reasons", the other docs are updated continuously. There are even Apocalypses which are not written yet, but of which there's already a synopsis available.

    In this sense no book was just as obsolete the very moment trees were being cut as "Perl6 essentials" is!

    Anyone know of such a chart / paper?
    Indeed many charachteristics of Perl6 are known. But even basic features keep being redefined and every now and again Larry pops out with a new idea or a rethinking of an old one.

    All in all the language will be made more consistent. I've often had the impression that it will be slightly less magic as well. But it will still perceivably be Perl. In some sense some amount of magic is being moved from ad-hoc deviations from orthogonality into basic features of the language. For example the way split() works with a regex will not be split() magic anymore, but it will be a well definite consequence of how regexes are evaluated in different contexts.

    Said this, evidence supports the claim that every single Perl programmer will find some charachteristic or another of Perl6 to be unpleasant or difficult to get used to, to say the least.

    The behaviour of sigils will be certainly changed. A scalar will always be a scalar, an array will always be an array and a hash will always be a hash. So, to explain with an example, you will have @_[0] instead of $_[0], and similarly for hashes. Some people like this, some people don't.

    It will be slightly less free-form: putting whitespace between certain tokens will either change the meaning of the program or result in a syntax error. Perl hacker extraordinaire Abigail is particularly upset by this choice.

    There will be unicode operators. Larry has no doubt about this. All of these operators will have an ASCII equivalent too. Some people like this, some people don't.

    It will have a complex type system, albeit optional: i.e. you may specify for efficiency that an array contains only integers, or 4-bit numbers or whatever kind of data you like.

    It will be a massively OO language, even if this won't be forced upon the user and a simple script could still look much like a Perl5 one. As a consequence of this, many predefined variables are going away, substituted by suitable predefined methods.

    An interesting idea in this sense is the syntax for calling a method on the topicalizer: you use .method() for $_.method(). Similarly you can even use $var.=method() for $var=$var.method().

    There will be an ubiquitous presence of adverbs that will modify the action of verbs, that is of functions or operators.

    There will be improved function prototyping along with facilities for passing in truely named variables, optional ones, etc. This includes the ability of defining for example new binary operators (i.e. "simply" functions which accept a parameter on the left and one on the right), but also circumfix ones like parentheses that act on what's between them, and all sort of things like these.

    There won't be regexen any more... there will be rules, powerful enough to e.g. parse XML natively. But even more complex languages: in fact, just like in some sense classes group methods, a new concept will be introduced, that of a grammar such that grammars will group rules (incidentally this will be more than a passing similarity, they say) and there will be at least one predefined grammar: Perl6's one. So that modifying suitably that grammar you can modify the parser at compile time. Some people see evident risks in so much freedom.

    In the sense of the paragraph above "Nothing but perl can parse Perl" will be promoted to "Nothing but Perl can parse Perl".

    Another desirable feature will be given by the fact that there won't be two orthogonal variable systems anymore: lexical variables will "simply" be variables in the magic MY package. Personally I'd like this feature to leak into some major release of Perl5...

    What else? Well, lazy list evaluation, hyperoperators, traits, roles etc. Well, these were only a few randomly chosen topics anyway...

    What i also like to know if there is a mod_perl6 coming up etc. etc.
    Huh?!? You bet there will be, but it seems to me the least thing one should care about. Perl already is a full-fledged programming language and this won't change with Perl6. Indeed (too) many people think of Perl as of a web authoring tool, but notwithstanding the fact that it is actually well suited for it and it has a long tradition in this sense (IMHO with too many bad side-effects) it is quite limitative to think of it only in these terms.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://419535]
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-05-27 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (94 votes). Check out past polls.

    Notices?