Perl6 Essentials

Randal, Allison; Sugalski, Dan; T¦tsch, Leopold
2003
ISBN
198pp
Date finished: 2004-01-06

With just under 200 pages (and 30 of those pages are a reference guide to Parrot opcodes), this trim book is an overview of the current design for Perl 6 and of the design of Parrot, the virtual machine that Perl 6 will run on.

The first chapters provide a historical overview of where the idea of a complete Perl rewrite came from. The meat of the book starts in chapter 4, which discusses the language features specified for Perl 6 as of June 2003. What's been decided upon includes Basic data types, operators, control structures, function calls, and the rule-based parsing that will replace regular expressions. Little has been decided about objects beyond how they're created and invoked, and they get only three pages out of the chapter. Other topics, such as a module system, standard library, and OS interfaces, are completely unspecified at this point, except perhaps inside Larry Wall's head.

Perl 6 is not going to attract anyone away from Python; if you find Perl 5 as confusing as I do, Perl 6 turns the knob up to eleven with more operators and more contexts. One operator can be written using the Unicode guillemet characters, opening up the space of possible symbols considerably. (APL, anyone?)

An odd new data type, the junction (scroll halfway down the page), behaves something like a set so that you can write comparisons such as if all($a0, $a1, $a2...) == any($b0, $b1, $b2, ...). It's cute, but I find it difficult to think of coding problems that junctions would really simplify.

Perl 6 may well turn out to be the PL/I of scripting languages, crammed full of features and impossible to keep in your head. If you don't like Perl 5, liking Perl 6 any better seems unlikely and I doubt it'll attract any Python/Ruby/Java/PHP coders.

The rest of the book is about the Parrot virtual machine and therefore is more interesting to a non-Perler. Parrot's impressive feature list is summarized in chapter 5. Annoyingly all the text is written in the present tense, making it impossible to tell which features are actually implemented, which ones are designed but not implemented, and which ones are future goals. For example, on page 81 we're told "Parrot has comprehensive support for [asynchronous] I/O, threads, and events." You'd have to dig through the source code or pore through the perl6-internals archives to discover that async I/O doesn't seem to be implemented and the shape of threading support is still unknown. Another example from page 89 is "Python, Ruby and Perl 6 all share a common (but hidden) base class in Parrot's base object type, so they can inherit from each other without difficulty", but such implementations haven't actually been written yet.

The last two chapters are concise but detailed documentation for the Parrot assembler and the slightly higher-level IMCC compiler for intermediate code. Material also includes an opcode reference and the first explanation of lexical scratch pads that I've seen. These two chapters are quite helpful.

Overall this book is a really good overview of Parrot, though bits of it are vague about what's vaporware and what isn't, and other bits are gradually becoming outdated as Parrot development continues. The Perl6 material is of less interest unless you're already a Perl user and want to see what the future might hold.

Tagged: programming languages

Permalink: http://books.amk.ca/2004/01/Perl6_Essentials.html

%T Perl6 Essentials 
%A Randal, Allison 
%A Sugalski, Dan 
%A T¦tsch, Leopold 
%@ 2004-01-06 
%K programming languages 
%D 2003 
%P 198pp
%G ISBN

http://books.amk.ca

Contact me