Channels ▼
RSS

Web Development

Review: Perl 6 Essentials


Jul03: Perl 6 Essentials

Perl 6 Essentials

The Perl Journal July 2003

By Russell J.T. Dyer

Russell is a Perl programmer, a MySQL developer, and a web designer living and working on a consulting basis in New Orleans. He is also an adjunct instructor at a local college where he teaches Linux and other open-source software. He can be reached at russell@dyerhouse.com.



Perl 6 Essentials
Allison Randal, Dan Sugalski, and Leopold Totsch
O'Reilly & Associates
200 pp., $24.95
ISBN: 0-596-00499-0

O'Reilly & Associates has announced a new book on Perl 6 which should be available by the time you read this. Perl 6 Essentials is unlike any of O'Reilly's other Perl books; it's not a normal tutorial, per se. Instead, it's a detailed review of the current state of the Perl 6 project, as well as a fairly thorough introduction to Perl 6 and the Parrot environment. If you've been wanting to know what to expect from Version 6, you won't find a better book on the subject. It's especially useful if you're considering getting involved in the development of Perl 6. Additionally, Python and Ruby programmers may find the chapters on Parrot (the programming-language-neutral interpreter) of interest.

Style

Not an overly lengthy book (about 200 pages), Perl 6 Essentials comprises a mere seven chapters. One could read it in a week or two, but you shouldn't rush through it. There's plenty for the reader to absorb. It's a comfortable read—although three authors worked on the book, there is a unified voice. This is a book to be digested: It's not a practical book with exercises at the end of each chapter requiring you to read it by your computer.

You may not want or need to read all of Perl 6 Essentials. It probably contains more material than you want to know, even though it's relatively short for a computer book. Instead, selective reading may be called for here. The book's preface gives some suggestions on which chapters to read for different purposes, for different types of readers or programmers. However, to make your own choices, I'll dedicate the remainder of this article to reviewing the contents of each chapter.

Content

The first chapter contains an interesting short history of the beginning of Perl 6. It names some of the key people who started the project and those who are now in charge of each major component and stage. It's quite a nonjudgmental overview of the Perl community and the state of Perl 6 affairs.

Chapter Two, as brief as it is (only eight pages), is broken up into two parts: The first part is on how to get involved in Perl 6 language development. This is the essentially linguistic aspect of Perl and the level that most of us think of when we discuss or work with Perl. The second part of Chapter Two details how to get involved in Parrot development. The Parrot project is partially under the Perl 6 umbrella. Parrot encompasses the development of Perl 6 internals. However, Parrot goes further in that its design goal is to accommodate Python, Ruby, and some other similar languages, as well. It's to be a language-neutral run-time environment, allowing for flexibility and compatibility in the general programming community.

A linguistic tutorial on Perl is provided in Chapter Three. It encompasses the theoretical language goals of the project. It's not an overly technical or long-winded chapter. The authors work through a series of linguistic principles with regard to Perl. They provide the reader with simple examples, using English language phrases and sentences as illustrations and close analogies in Perl. This chapter has good instructions for potential and existing contributors to Perl 6. It attempts to help would-be contributors to understand the linguistic policies to which Larry Wall and other Perl language leaders have been adhering. One of the goals is to prevent Perl from becoming rigid and forced like many other programming languages, languages in which there is only one way to do things.

Perl syntax is reviewed in Chapter Four. It's a very brief run-through of variables, arrays, hashes, references, and other components of Perl. One wouldn't use this as a substitute for O'Reilly's Learning Perl book. Instead, it's useful in getting the reader in sync for the chapters that follow and for the reader's potential involvement in the project. I found it helped me to remove myself from the details of Perl, and pull back to the conceptual level. Chapter Four is not a lightweight chapter, though. It teaches Perl as one would a spoken, purely human language. It is more detailed than the strictly theoretical approach of Chapter Three, but it doesn't get lost in the minutia, either.

Chapter Five covers Parrot: its essential purpose and the goals of the designers, as well as its architectural structure. Chapter Five describes the function and role of each component of the Parrot architecture: the parser, the compiler, the optimizer, the interpreter, and the bytecode loader. The authors explain the interpreter in great detail, because it's where most of the action resides—actually this part composes 19 of the 25 pages of Chapter Five. They explain how the interpreter handles strings and variables, and how it reacts to and controls processes and threads. Chapter Five also explains how Parrot is intended to deal with objects. (This could be particularly tricky, because the Parrot project has the ambitious goal of being compatible with Perl, Python, and Ruby, and their manners of implementing objects are slightly different.)

The Parrot assembly language (PASM) is covered in Chapter Six. It provides a tutorial on working with PASM, which includes Parrot Magic Cookies (PMC: low-level objects). Apparently there are whole other worlds below the surface of Perl that many of us take for granted. The end of the chapter provides a brief reference manual (24 pages in a format similar to Perl in a Nutshell) on PASM commands (or rather, opcodes).

The final chapter, Chapter Seven, covers the Intermediate Code Compiler (IMCC). The IMCC is an alternative compiler for Parrot bytecode which can embed the Parrot run-time engine to shorten the compile time. The IMCC uses the language called "Parrot Intermediate Language" (PIR). PIR overlays PASM and as such, it is a step above PASM. Like the previous chapter, this chapter ends with a short reference manual (about eight pages) on PIR directives and instructions.

Conclusion

Although Perl 6 Essentials has a practical purpose in that it calls the Perl community to action and provides them with information to help them choose an area of participation, this is primarily a theoretical work. If you're looking to improve your Perl skills in immediate and practical ways, this may not be the book for you. However, if you're looking to deepen your understanding of Perl (Perl 5 included), then a careful reading of this book will help. It will also help prepare you for Perl 6; it will allow you to write better Perl 5 code now with an eye toward the not-so-distant future. In short, Perl 6 Essentials may not be essential for all Perl programmers, but all Perl programmers can probably benefit from reading it.

TPJ


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 
Dr. Dobb's TV