Why Perl 6 is different
Let’s be honest. Perl 5, Python, Ruby, they’re almost the same. There are some differences, but when your compare them with C, Java, Haskell or some such they suddenly feel rather superficial. They suitable or unsuitable for pretty much the same tasks, occupying a niche that Perl pioneered: that of a high manipulexity and whipuptitude.
They each operate at the same abstraction level. Even if a language is lacking a feature that the others have, it’s easily implemented using other constructs. There are plenty of valid reasons to prefer one over the other (taste, library availability, programmer availability), but they all offer the same power. Perl 6 is going to change that.
Perl 6, like Perl 5, Ruby and Python steals a lot from other languages. As you may expect, it steals too many things to mention from Perl 5. It steals chained comparisons from Python, objects from Smalltalk (in particular Squeak’s traits should be mentioned). It thankfully steals nothing from PHP.
It has been said that Ruby is Smalltalk with a perly syntax. Perl6 extends on that: Perl 6 is Lisp with a perly syntax.
Perl 5 is already more lispy than most outsiders realize, but Perl 6 takes that to a new level. It is built around a MOP and multimethods. Lists are quite important in it (though their semantics are more like Haskell than Lisp in being lazy). And it has macros.
Macros in Lisp are one of its most powerful features. It gives the programmer the power to mold Lisp into any shape he wants it. In Lisp macros are possible because its uniform syntax of trees of symbols. In Perl 6 macros are made possible by its key innovation. One of the feature it didn’t steal from another language: rules and grammars.
Regular expressions is the most stolen feature from Perl among other languages. It’s ironic that even Python, whose community is most critical about Perl’s syntax, took its ugliest feature in essentially unmodified form. (For an overview of all that is wrong with it, see the introduction of Apocalypse 5). It’s no coincidence that this part of the language has been redesigned from the ground up. In doing so, Larry profoundly changed the language. To quote A5: “Regular expressions are our servants or slaves”; in Perl 6 he emancipated rules and grammars to first class citizens.
Rules are like regexps, but also like methods/functions. Grammars are like classes for rules. This makes rules vastly more powerful. So powerful in fact that Perl 6’s syntax itself is defined in rules and thus in Perl 6 itself.
I can’t overstate how profound I think that change is. I think it’s no less profound than when Lisp made functions first class citizens. For the first time it will be possible to have all the metaprogramming power Lisp has without having to compromise on having syntax. Regardless of the success of Perl 6 (though obviously I do hope it will be successful), I predict that this feature will be its long term contribution to language design.