What Perl 6 Is Going to Do

Ovid on 2008-10-01T08:07:24

In a response by chromatic to a comment in a Perl 6 discussion, he wrote:

Most of the [Perl 6] features in the list I quoted are impossible [in Perl 5] without either a superhero-sized shoehorn to wedge feature after features into the internals without destroying the whole thing (because refactoring is nearly impossible)

He was writing that in reference to Perl 5 internals, but if you look at the feature set of Perl 6, you could apply this to programming languages in general.

Though many are still not aware of this, Perl 6 gives people things they want, but like the features of a powerful word processor, different people need different things and features that I desperately want and have been denigrated by others (I'm still amazed at how many programmers think introspection isn't very useful). Programmers used to argue that recursion was useless. Some people still argue that OO is useless. I see people reaching for an RDBMS when what they really need is an embedded logic programming language (Linq, anyone?). I have programmed in or read about many programming languages and there's not a single one which offers the power and flexibility that Perl 6 offers. It's going to be a game changer and like Java moving ahead when C# was introduced, many other programming languages are going to be pushed forward when Perl 6 comes into its own. However, they're going to be hobbled until they can offer the powerful grammar capabilities that Perl 6 offers, or offer far better interoperability with other programming languages.

My only concern about Perl 6 is that its size and complexity are going to scare many programmers, but the upside is that basic Perl 6 is easier to learn than Perl 5. As with many other languages, we'll see teams where experts work on the really hard problems that Perl 6's powerful capabilities can solve and less experienced programmers will stitch those bits together. However, those programmers are still going to be exposed to things which will confuse them.

my @array = 1, 2, 3;
@array ,= 4, 5, 6;
my @negatives = -<<@array;

That's going to take a lot of time for people to grasp. No, not the example above -- I mean all of the examples. Perl 6 is not Perl 5. We have punctuated equilibrium instead of gradual evolution. Perl 6 is a new species and until Perl 5 programmers are willing to overcome their fear and just dive in, they'll be the evolutionary throwbacks.

Of course, what I write above is merely opinion with precious few facts to back it up. Those "facts" are widely documented elsewhere and perhaps I'll have to eat my words that basic Perl 6 is easier to learn than basic Perl 5, but I will focus on one thing: Parrot. Parrot is not Perl 6 and there are Perl 6 implementations not build on Parrot (SMOP and Pugs, for example). But Parrot, combined with Perl 6, is truly going to change things. With Parrot and grammars, you can easily write your own language on the fly. I'm not talking about the "DSLs" which some programmers like to tout. Those are generally little more than pretty wrappers around existing functionality and they're still bound by the constraints of the languages they're built in. With the Parrot Compiler Toolkit, you'll be able to write assembly code with a lovely grammar on top of it which can alter the language at a fundamental level. No longer will you be bound by what the authors of the language felt you needed (aside from what's in Parrot, of course). You'll be bound by your imagination and creativity.

There is the "Forth" danger to worry about, though. A well written Forth program can be read and understood by an expert in his or her domain. However, many Forth programs are unreadable and unmaintainable because the programmers didn't put enough thought into them. I don't think this is going to be a problem with Perl 6 because I expect that these tools will not be the first choice for solving many problems, but the danger is still there.

At the end of the day, though, the Perl 6/Parrot double-team is going to put pressure on many other programming languages to keep up. I also expect that it's going to finally make programmers sit up and notice what dynamic languages can really do. We know the power of dynamic languages, but those who don't live and breathe them generally don't, for the same reason that people don't understand what languages like Prolog and Haskell can do for them. The next few years are going to be very exciting and unless Perl 6 adoption is far worse than I expect, it has the potential for revolutionizing programming -- just as it's already revolutionized Perl 5.