Channels ▼
RSS

Web Development

Perl 6 Now: The Core Ideas Illustrated with Perl 5


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


Perl 6 Now: The Core Ideas Illustrated with Perl 5
Scott Walters
Apress, 2005
424 pp., $39.99
ISBN 1590593952

Perl 6 Now sets out to teach Perl 6, the Perl of the future, in terms of Perl 5, the Perl of today. This book is the first I've seen that can legitimately claim to be a genuine Perl 6 book. It does a creditable job of language coverage, but the author is logorrheic and continually core dumps. The combination of good tech and supercilious prose makes Perl 6 Now go down something like chili-garlic sauce in Cream of Wheat. It's still a pretty darned funny book, one quite informative on the subject at hand. And you can't fault the good heart of the author, who pledges twelve-and-a-half percent of the royalties from the book to the Electronic Frontier Foundation (EFF).

Author Scott Walters appears from his photo to be one of Jerry's Kids (Garcia, not Lewis). He wandered through Forth and Snobol before reaching Perl, which should have given me a hint of what was coming, your reviewer having written the first book about ANS Forth in a similar style (Forth: The New Model. M&T Publishing, 1992, ISBN 1558512772). Walters is a genuine language nut, which renders him entertaining as a raconteur and somewhat infuriating as a tech writer. He's the smitten enthusiast, and he's not letting go of your arm before you've viewed his entire private collection.

In the first section of the book, Walters attempts to reconstruct some of the history of computer science that transpired before his advent on the scene in a fashion most clever and entertaining, albeit exaggerated, tendentious, and inaccurate. For example:

"Perl 5.00, released in 1994, introduced objects, a feature first realized in Simula (1968), where it languished in academia for nearly 20 years before it was popularized by C++."

He means "finally adopted" rather than "introduced," i.e., "introduced" into the autonomous universe of Perl the author inhabits. Though Walters later acknowledges Smalltalk, he seems unaware that it so far from "languished in academia" that it became IBM's primary means of applying GUI technology to enterprise applications for roughly a decade. And:

"From PL/I (1965), Perl 5.005 took multiple concurrent threads of execution."

This is rapture rather than reportage. Perl took threads from the platforms it was executing on and from overwhelming sentiment in the developer/user community that it should do so like every other significant contemporary programming language already did.

The book has a didactic concept, or rather, several. Didactic concept #1 is that you're going to grasp Perl 5, or you will pause to grasp Perl 5, with precious little assistance from the book (perldoc is suggested), and then proceed to absorb a literary treatment of Perl 6 as a delta of evolution from Perl 5. After the first chapter, didactic concept #2 emerges: Namely, as long as you came to visit, the author will sit down and chattily teach you Perl 6 in its entirety, but you really ought to know Perl 5 because it will be around for a very long while in maintenance, and don't say the author didn't warn you. Yet a third concept is that the book will teach you Perl by teaching you all of computer science that might conceivably be relevant to the particular language construct under discussion, and explain how Perl embodies the theoretical abstract, or strives to, or fails to, or used to fail but now conquers the heights victoriously in Perl 6.

In the Introduction, Walters means to teach you, in a general way, how to install and maintain Perl, but he has such a wonderful time telling the reader about many other things he has studied that the fragmentary and idiosyncratic choice of practical content for the chapter is squeezed exclusively into the last few paragraphs.

Part 3, "Threads and Objects," commences with Chapter 12, "CPAN Modules," the "Summary" of which intones thusly:

"Remember that (like so many modules documented in this book), B::Bytecode isn't stable but is considered a working prototype. Generally, when it fails, it fails completely rather than subtlety. The status of other modules mentioned in this section varies between experimental, proof of concept, and production. This doesn't mean that bug reports aren't welcome, but reported bugs may not necessarily be fixed in a timely fashion."

Is that really the item that should be foremost in the mind of the reader at this juncture of the exposition?

Chapter 10, "Block Structure," commences:

"Assembly language, COBOL, and old versions of BASIC don't indent code to distinguish the code run in a loop or run conditionally from the normal flow. Block structure defines scope. Scope is the area (approximately the starting line and ending line or the file or the package) in which a variable, method, or subroutine is valid."

This sort of treatment is the norm in Perl 6 Now. The third sentence (with some work) should have been the first, the first should never have gotten past the editor, and the word "defines" should be "delimits."

Chapter 14 "Objects" starts out:

"Objects are instances of classes. Classes are reusable logic. The logic may be reused not only in different programs but multiple times in the same program. Each instance of reuse has its own private data, cleverly named instance data. This chapter is about the Perl6::Classes module, the Attribute::Property module, and Apocalypse 12, the object specification for Perl 6."

Is there any reader who understands this chapter-opening paragraph who needed to hear the first two sentences? Another discussion informs the reader:

"given blocks topicalize a parameter as $_, the default variable, for when blocks to test against. In topicalizing its parameter to $_, given behaves like the for statement. when is a specialized version of if that knows how to compare different types to each other and executes the equivalent of a last when a match is found."

As the "Who This Book Is For" acknowledges in a roundabout way, the book is written primarily for people who are into Perl qua Perl. Surely, they will lavish Perl 6 Now with praise in the newsgroups. Some may even read it, if they have time to spare from programming Perl.

The chapters can be cross-referential, with knowledge from a later chapter needed to grasp the discussion of the current chapter. An example is Chapter 20, "Continuations," which commences with a few confiding observations that imply you understand coroutines, discussed in Chapter 21. Admittedly, a chart of chapter dependencies is found in the introduction. But more coherent and disciplined technical writing would have rendered this superfluous.

Anecdotal irrelevancies and superfluities lard the text of Perl 6 Now. Yet there's real substance everywhere. You just have to pick out the signal from carrier wave, which can be difficult when an author imposes so much of his intellectual context on the reader. Walters quotes Albert Einstein, "Intellectuals solve problems: geniuses prevent them." The good doctor might also have observed that intellectuals striving towards genius cause almost as many problems as they solve, which would explain a lot about this book.

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