[sf-perl] Perl 6 Now by Scott Walters (fwd)
matt at cloudfactory.org
Wed Aug 17 12:29:04 PDT 2005
from sfpug member joe brenner...
---------- Forwarded message ----------
Date: 17 Aug 2005 19:26:01 -0000
Subject: Perl 6 Now by Scott Walters
Posted by: timothy, on 2005-08-17 19:02:00
from the now-and-then-or-later-or-earlier dept.
Joseph Brenner writes "Every now and then, a beginning programmer
asks if there's any point in learning to program in Perl 5, when Perl
6 is going to change everything soon. There are a number of answers to
that: one is to point out that Perl 6 is still years away, another is
to point out that it is promised that Perl 5 code will run under Perl
6 without modification (a module that begins with the traditional
"package" statement is Perl 5 code; if it begins with the new "class,"
then it's Perl 6)." Read on for the rest of Brenner's review of Scott
Walters' Programming in Perl 6 style using Perl 5, a book which
answers that question a whole different way.
Scott Walters here pursues what might be thought of as the third
answer: you can learn Perl 6 now and immediately begin writing
programs in a "Perl6ish" sort of way, using appropriate CPAN modules
that have been used to implement approximations of Perl 6 behavior:
Perl6::Variables, Perl6::Export, Perl6::Contexts, autobox,
Perl6::Classes, Switch, and so on.
There are many caveats about using these tricks in production code,
however, and Scott Walters doesn't shy away from warning you about
them (e.g. p.43 "Source filters are dangerous" where he discusses
their increased start-up overhead and potential bugginess -- though he
doesn't mention my own peeve which is that they're very confusing when
you try and use the Perl debugger).
So possibly the book is not really quite so well suited to an actual
beginner-- who probably should not be told about "use Switch 'Perl6'",
but the device of spending the early stages of the book directed
toward a beginning audience makes it a very useful review for people
like myself who have been reading the Apocalypses, but don't
remember every detail.
And on the other hand, the book includes some prominent early warnings
about common gotchas that beginning programmers seem to be prone to --
e.g. using dynamically defined variables instead of just using hashes.
The standards for writing English in the Perl world are pretty high --
the core members of the Perl community have always cared a lot about
clear writing, and it's arguably the world's best documented language
(critics will no doubt add that it needs to be). Unfortunately, I
can't say that Perl 6 Now quite lives up to this standard. This is a
book that was written in a hurry, and it shows: hasty sentences and
minor organizational problems abound (e.g. one or two items seem to be
discussed in the wrong place; there are an awful lot of explicit
forward references, and yet there's at least one place where something
was used in an example before being discussed a few dozen pages
later). But then in Scott Walters defense, this is certainly a book
that needed to be written in a hurry, because its subject matter is
such a moving target.
And where the book really shines is in its code examples: short, clear
and to the point; the author repeatedly shows how something can be
done in Perl 5 code and how it's expected to work in Perl 6. These
examples are always clearly labeled "Perl 5" or "Perl 6" in the
comments, so that the two can't be confused.
The subjects of some of the examples are pretty cool: e.g. he talks
about using PDL ("Perl Data Language") to crunch audio data in MOD
format, which I was completely unfamiliar with. A *.mod file
essentially contains the "sheet music" for multiple parts (really,
MIDI) plus sound samples that specify how notes will sound for each
voice. This is discussed in Chapter 7, which is also the free sample
chapter. I also liked random walking Arizona's highways as an example
of Graph navigation (Chapter 8, p 159), and I appreciate the fact that
he downplays inheritance in favor of delegation in his discussion of
objects (Chapter 14, p. 262).
All in all, this book is a fun read for the Perl fanatic.
(Note: the title Perl 6 Now bears a strong resemblance to an emacs
package I've been working on called perlnow.el, but there is no
You can purchase Programming in Perl 6 style using Perl 5 from
bn.com; it's also available in eBook format (password protected PDF,
using your email as password) for $15. Source code and and a sample
chapter are available online: Slashdot welcomes readers' book reviews
-- to see your own review here, read the book review guidelines,
then visit the submission page.
1. mailto:doom at kzsu.REMOVECAPSstanfordANDTHENREMOVEMORECAPS.edu
More information about the SanFrancisco-pm