Perl 6 and Parrot Essentials

The focus of Perl 6 and Parrot Essentials is on the goals, development process, and design of the revised language and its underlying language-independent runtime engine.


December 01, 2004
URL:http://www.drdobbs.com/web-development/perl-6-and-parrot-essentials/184416177

December, 2004: Perl 6 and Parrot Essentials

Jack J. Woehr is an independent consultant and team mentor practicing in Colorado. He can be contacted at http://www.softwoehr.com/.


Perl 6 and Parrot Essentials, 2nd Edition
Allison Randal, Dan Sugalski, and Leopold Tötsch
O'Reilly Press, 2004
256 pp., $29.95
ISBN 059600737X

Parrot (http://www.parrotcode.org/), the new language-independent virtual machine that provides the runtime execution for Perl 6 (and for Ponie, an implementation of Perl 5 running on Parrot), is about 43 MB of somewhat-difficult-to-compile source. The Perl 6 language itself, a community rewrite of Perl, was the chicken that came after the egg, the idea of separating the execution engine from the language parser already having gained a foothold in the Perl community prior to the notion firmly taking root that Perl semantics need a major, code-breaking overhaul. ("Code-breaking" may be a little harsh: The promise is that Perl 5 programs will be mechanically translatable into Perl 6.)

Perl 6 and Parrot Essentials, 2nd Edition is an update of the recent Perl 6 Essentials (ISBN 0596004990). From the title shift, you'd suspect that Parrotis the difference between the two books; but Parrot, covered here for about 160 pages, was covered to the tune of about 110 pages in the previous edition. The remainder of the 80-odd pages added between the first and second editions are devoted to a more detailed and better factored discussion of the Perl 6 language. Perl 6 promises to be a "new-and-improved" Perl architected along cleaner lines. For example, I find it amusing and gratifying that in Perl 6, all { } blocks are now closures. This is nice for me because I always reflexively assumed they already were closures and thus my code was, as you might guess, occasionally subject to surprising results.

Perl 6 and Parrot Essentials is concise and exhibits the tidiness of a theoretical work. Achieving such pristine beauty was simplicity itself for the authors since they can't tell you all the gory details about Perl 6. Perl 6 hasn't been fully invented yet: It's a work in progress. Alongside filling you in on all truths so far revealed, the book gives organizational details of how to participate in the ongoing work of this largish, open-source project. Coauthor Dan Sugalski, the chief architect of Parrot, is in a position to know such things, as likewise are coauthors Leo Tötsch, the Parrot pumpking (as our witty community styles its release coordinator), and Allison Randal, Perl 6 core development-team project manager.

Virtual machines being somewhat more concrete in nature (virtually concrete?) than language semantics, there is already more definition to Parrot than to Perl 6. Well, let's put it this way: Parrot is up and running already, and Perl 6 is not fully so yet. Virtual machines as a mechanism of interpretive language execution were pioneered in practice by languages such as Pascal, Forth, and Prolog (remember the WAM, the Warren Abstract Machine?), and later Java. It's gratifying to see that project participants have seen fit to make an historical tribute by implementing a sample Forth engine in Parrot. Parrot Forth is not fully ANS-compliant Forth, but that's a Forth tradition in itself. And if anyone doubts that the Forth tradition of "programming religion" still lives, they will reach satori when they learn from the book how Perl advances via what Perl creator Larry Wall and the team term "Apocalypses" and "Exigeses."

While the metamorphosis of Perl into Perl 6 is arguably the most useful coverage in the book, Parrot is by far the more nerdly entertaining. Parrot ends up taking the Perl programmer for a dive deeper than most high-level language jockeys usually dare to descend.

The focus of Perl 6 and Parrot Essentials is on the goals, development process, and design of the revised language and its underlying language-independent runtime engine. It might have been nice, albeit a little off-message, if the authors had given some information about working with the Perl 6 and Parrot source code tree as it currently exists. It is not obvious to the newcomer how to build and install Parrot from source, despite the presence of a "configure/make/make install" procedure. The procedure is understandably rough and buggy, and the result is anything but tidy. Actually, using Parrot to run what exists so far of a prototype of Perl 6 turns out to be something of an existential conundrum. As Leo Tötsch said on one of the lists, "Perl 6 people are preparing a parser currently, should arrive RSN. But Perl 6 hacking is a bit hidden from the public still."

Overall, Perl 6 and Parrot Essentials is a notable volume, significant for the moment as an invitation to an ongoing worldwide Perl community effort, and for some time to follow as a monument to the clarity of purpose and speed and excellence of execution of the development effort itself. Surely there will be at least a third edition in a year or two as the work on Perl 6 and Parrot reaches its fulfillment and a definitive tome becomes a possibility and a necessity.

Thus, you ask why a working Perl programmer like yourself, well-steeped (as in boiling water) in Perl 5, would have any pressing interest in reading now about Perl 6? Perl 6 will not be ready-as-in-ready-and-stable for a year or two. When finally ready, Perl 6 will present a naggingly incompatible environment to your current code corpus. Aside from givens such as personal anxiety to keep current in the field and irrepressible programmer's curiosity, the best answer as to why you should participate in Perl 6 now is the same answer as to why you should participate in the political system; that is, as a form of self defense.

The publisher's web page for Perl 6 and Parrot Essentials is at http://www.oreilly.com/catalog/059600737X/index.html. As an alternative to buying the print book, you can read it online at Safari (http://safari.oreilly.com/?XmlId=059600737X). The preview is free, but to read the whole book, you must subscribe.

TPJ

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.