Perl 6 Essentials
Make no mistake, Perl 6 isn't here yet, but it's coming. The book starts with a good explanation of "the plan"; chapters 1-3 deal with the history, goals, and design considerations of the project. It's a good conceptual overview of the process about how it has been run so far, and how it seems to be continuing. Chapter 3 is of special interest, as it showcases some of the in-depth thought that has been poured into the project. Though we all aren't language theorists, it helps allay some of the fears that change brings while being completely fascinating reading.
This first part of the book isn't very useful without a fairly solid Perl 5 background. It wastes no time in chapter 4 discussing syntactical differences in the v5 to v6 transition. Programmers should be pleased with the practicality of the approach to the new language, as it refers to the new structures and features, and how they solve simple workarounds that Perl veterans are used to in Perl 5. Currying, multimethods, class definitions and structures, new operator syntax, and the dynamics of the new regular expression engine (now called rules) are all touched on, and their values made obvious to the reader.
The last three chapters are for those interested in Parrot development and those who wish to port languages to Parrot. (There are active projects to port Python, Ruby, and even .NET to Parrot.) The section has a slight perl slant to it, but is really about the interpreter and compiling / running Parrot code. It is a fairly complete reference to the different parts of PASM (Parrot Assembly Language), and its role in porting languages to use Parrot. A comfort with assembly language basics is assumed in these sections, as the syntax and concepts of registers and machine code are made easier with general assembler familiarity. This part was somewhat dry for me, as it reads more like a reference than anything else, but it covers the topic fully without droning or leaving anything out. Examples are abundant and range from the simple, to the integrated, and are enough to get people started programming and writing tests with Parrot bytecode.
It should be noted that this book is valid and accurate now, but any development project can make changes quickly. There are places where the authors have admitted that a feature isn't in stone, and is possible to change. According to chromatic, an editor for O'Reilly, the plan is to update the book once a year until Perl 6 is released. Until then, a great place to keep up to date for the casual observer is at the p6p digest. This book goes down a lot easier than the Apocalypses, RFCs, and Exegeses, and I'd heavily suggest it to anyone who is serious about being ready for 6 or joining in on development . I preordered it from Amazon when I saw it was coming out, and am quite happy with my investment.
Table of Contents- Project Overview
- The Birth of Perl 6
- In the Beginning . . .
- The Continuing Mission
- Project Development
- Language Development
- Parrot Development
- Design Philosophy
- Linguistic and Cognitive Considerations
- Architectural Considerations
- Syntax
- Variables
- Operators
- Control Structures
- Subroutines
- Classes and Objects
- Grammars and Rules
- Parrot Internals
- Core Design Principles
- Parrot's Architecture
- The Interpreter
- I/O, Events, Signals, and Threads
- Objects
- Advanced Features
- Conclusion
- Parrot Assembly Language
- Getting Started
- Basics
- Working with PMCs
- Flow Control
- Stacks and Register Frames
- Lexicals and Globals
- Subroutines
- Writing Tests
- PASM Quick Reference
- The Intermediate Code Compiler
- Getting Started
- Basics
- Flow Control
- Subroutines
- IMCC Command-Line Options
- IMCC Quick Reference
You can purchase Perl 6 Essentials from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This one is a great addition to the book shelf, you all know how to do certain things in Perl 6 but this book clarifies nicely why you are actually doing it. Also, it introduces nice new perl concepts which hardcore perl 5 scripters might not have come across before.
There is no god
Hello Slashdot,
Recently I've had a chance to do some web design with PHP. Previously
I'd used Perl because I'd heard from many people that Perl was the end
all and be all of scripting languages for the web. Imagine my suprise
to discover that PHP was vastly superior! I know this is a bold
statement, but I have solid arguements to support it.
Before I begin, let me just clarify something. I'm not arguing that
PHP is better than Perl in all cases. There is certainly still a use
for Perl. Also, PHP isn't perfect but it does manage to fix many of
the shortcomings I've had with Perl. Here are a few of the things I've
noticed about PHP. Finally, I'm not the most talented Perl programmer
out there. I generally prefer to use the vastly superior Python, but
can use Perl if I have to.
* Ease of use. After about a day I had an excellent understanding of
both PHP and SQL. I was able to get a stable, useable and presentable
website up within 24 hours of reading the basics of PHP. Learning Perl
took me weeks and I'm still not even as good with it as I am with PHP.
I would definitely not recommend anyone new to programming begin with
Perl.
* The OO of PHP is excellent. In my experience, it rivals Smalltalk.
We all know that Perl's OO still needs work (whether or not OO is all
that great is another discussion.) Hopefully Perl will be patched up
so it supports such must-have OO features like introspection,
reflection, self-replication and ontological data-points.
* Outstanding database support. PHP supports virtually every DB under
the sun (although Berkeley DB is missing, oddly enough.) Perl seems
limited to MySQL and PostgreSQL, and its really a kludge for the
later. I've heard that this will be fixed in upcoming versions of Perl
though.
* Speed. PHP is one of the fastest languages I've ever used. While it
won't be replacing assembly or C, its definitely faster than Perl in
almost every case, particularly in regex which has long been Perl's
strongest point. I'm sure there are cases where Perl is equal to PHP,
but I can't think of any at the moment.
* Portability. I can take PHP code off my Linux box and plop it onto
an IIS server, or even one of those new Macintosh servers and have it
run without having to change a single line of code. Try doing this
with Perl! Its as though it was written in assembly, Perl requires
that much rewriting.
* Graphics. PHP comes with a nice little graphics library. While I
wouldn't use its to code the new Doom (VB would be a better choice)
its adequate for most web pages, and should be considered as a
substitute for Flash for certain things. Perl lacks a graphics library
of any kind.
* Data Structures. Under PHP you can create any type of datastructure
you need: Linked lists, binary trees, hash tables, queues, inverse
Reiser-biased recursion trees, etc. Under Perl you're extremely
limited in what you can do. This is because Perl isn't OO (so you
can't create Node classes, for example, usefull in a linked list) and
because it lacks pointers. Some of you may notice that PHP lacks
pointers, but look deeper! Behind the scenes, hidden from the user
pointers are used. Because of this, PHP can support complex data
structures.
Again this is just my experience. I don't mean to offend any Perl
coders because Perl was an excellent language. However, in certain
cases it may behoove one to write the back end in PHP instead of Perl.
C - A language that combines the speed of assembly with the ease of use of assembly.
Amazon has for $2.50 less than bn (almost 15% less!)
So that's what... like 100 pages of the string "Smoke crack" repeating?
print "Smoke crack" x 1000000 .. hey, that was pretty easy.
It's $4.50 cheaper at bookpool.
They're also doing a free shipping deal.
-Dave
I really detest it - for some reason it brings the worst in people - it encourages them to be "clever", writing obscure unmaintainable garbage. I have seen readable Perl - but it seems a rare thing.
Any idea why this is the case?
Bookpool.com rocks:l +6&Go.x=0&Go.y=0&Go=Go
http://www.bookpool.com/.x/t2y2rmrlx8/ss/1?qs=per
$15.50USD
There is no real way for you to figure out how many websites use Perl but you could figure out how many are hosted on Apache. Then you can assume that if they are running Apache then their server probably has Perl installed. ...so you can get a count of sites that might possibly be using perl! Oh, and I use perl in my sites so there you go, add one to your count of sites that use perl.
Agreed. This is especially important in the free software world, where every advantage we can get we need. With all these languages abounding, there is a divide in our community.
Or are they all Barnes & Noble affiliate-sales links? Who gets the money from the books you sell for Barnes & Noble? The reviewer? Slashdot? Or is there a Slashdot beer fund we can all dip into?
Those of you unfamiliar with Perl history may find it interesting that the "Parrot" started out as an elaborate April Fool's day joke two years ago. Here is the book that was announced. Strangely enough, people found the idea useful and are now actively developing it!
Slashdot's first reaction to VMware
It may come as a surprise that within the pages of 'Perl 6 Essentials'lies what could be two books
Not really, but what does NOT come as a surprise to me is that we have yet another glowing book review with a bn.com affiliate link. I've seen far too many glowing reviews on this site, about books that I know to suck donkey balls, to trust the reviews here anymore, especially knowing that readers are more likely to follow affiliate links when the review is positive than when it is not (And this from the same site where people so often rip stock analysts for writing glowing reviews of companies that garner their firms big i-banking fees). I wouldn't trust a movie review if I knew the reviewer was getting paid every time people went to saw the movie, and this is almost the same thing. Maybe Slashdot should put up a disclaimer...
If I see a book whose title sounds remotely interesting reviewed here, the first thing I do is go directly to amazon, and check out their user reviews. At least there you'll potentially see a bunch of negative reviews, instead of a chapter summary and a "this belongs on every Perl/PHP/Mysql/Linux geek's bookshelf".
You know, some programmers write things other than web pages.
Perl 6 Essentials is a sneak-preview of Perl 6, the widely-anticipated rewrite of the Perl programming language. Still in development, the Perl 6 project is a community-based effort to keep Perl vibrant well into the 21st century. This book covers the development not only of Perl 6 syntax but also Parrot, the language-independent interpreter developed as part of the Perl 6 design strategy. Although Perl remains a vibrant language with a fiercely loyal following, it has undergone many changes to keep up with new technologies and applications that were not anticipated when Perl was first introduced in 1987. Through its community-based development model, Perl has kept up with changing times and remained fresh when other languages might have stagnated. Internally, however, there have remained kinks and stumbling blocks that developers have needed to sidestep, long-abandoned features that have been maintained only for backwards compatibility, misdirected phrasings that have hindered more intuitive syntax structures, and a cacophony of modules that sometimes work well together, but occasionally don't. Perl continues to have a strong following devoted to its development, but in the meantime, a group of core Perl developers have begun working on Perl 6, a complete rewrite of the Perl language. While Perl's creative philosophy and common-sense syntax are sure to remain in Perl 6, everything else in the language is being re-examined and recreated. Perl 6 Essentials provides an overview of the current state of Perl 6 for those who await its release. Written by members of the Perl 6 core development team, the book offers an explanation of the various stages of the project, with reference material for programmers who are interested in what changes are planned or who may want to contribute to the project. The book will satisfy their curiosity and show how changes in the language will make it more powerful and easier to use. Perl 6 Essentials is the first book that offers a peek into the next major version of the Perl language. This book is essential reading for anyone interested in the future of Perl.
Bethanie: Whore...
Fan Whore
Surely somebody's scanned this book into a .pdf and redistributed it to the masses by now!
There's a Mercedes gap too. I want one and can't afford one, but it's not government's job to do anything about it.
So, how many editions should we expect?
Opinions my own, statements of fact may contain errors
You really need to find a better count than assuming any apache server might use perl.
Of course, if you just go read the Apocalypses and Exegeses on perl.com and the FAQ on parrotcode.org, you get all of this for free.
When I started using Perl 5 I figured it to be about 10 years ahead of its time. Being about 5 years since then I think I was pretty close to right.
Development of it is taking a long time but it has been worth it.
Some peoples minds don't seem to fit Perl 5 quite right and complain about it. Should have a lot more options of languages and style in P6.
Its a blazingly fast byte code interpreter. Having this Open Source is a very powerful thing and something many projects will find useful.
...instead of book reviews it starts putting full books e-texts. :)
For the love of god, don't use PERL. We are thirty years out of the seventies....
exactly. thirty years and we still can't fucking get past C. isn't it time we start using languages designed for humans and not machines?
If you've been keeping track of the Parrot project's progress for the past 2+ years you'd see that they're going nowhere fast. No language implemented other than a toy Basic language, no thread support, no object support, no exception support, no stable standard calling convention, no code module support (like Java .jar files), a proliferation of stupid one-off opcodes that should be method calls - and worse of all - no working Perl support. As for Ponie/Perl5 on Parrot - I'll believe it when I see it - this Parrot project blows more hot air than a thousands hair dryers. Tell you what - give me the $200,000 that they've been given and I will write the Perl6 interpreter for them. A lot of better open source projects have been written with little or no funding at all. There's no excuse for the pace of this project - it's directionless and leaderless.
(FYI, I posted this on the thread for this book's announcement.)
..." is a discussion and tutorial on a topic, intended for beginners ..." is the same, but for intermediate and advanced users
Understanding O'Reilly titles can help you decide which blue book(s) to purchase. Just as they have conventions for the books' color (e.g. Perl blue, Java purple, security yellow), O'Reilly and Associates has conventions for the titles.
* "... Essentials" means an overview of what's new.
* "Learning
* "Programming
* "... Cookbook" is a series of problems and their solutions
* "... in a Nutshell" is like a language reference
* "... Pocket Reference" is a shorter version of the above
Joe
http://www.joegrossberg.com
This book isn't about Perl 6 at all, and there's nothing about it that's "essential." Part of the book is about the *plan* for Perl 6, but that's just plain silly. Who wants to read about the plan for some that's in the middle of development? Odds are that much of this part of the book will be completely invalidated long before Perl 6 is actually released.
The rest of the book--most of the book, actually--is about the Parrot virtual machine. Now, really, does this matter to Perl programmers at all? Is there a book about the innards of the interpreter used for Perl 5? Or a book about Python bytecode? It only matters if you're going to write a compiler that targets Parrot. And, again, note that Parrot is also a work in progress and will likely change dramatically before Perl 6 is actually released.
In short:
1. This is a book about vaporware.
2. Most of the book is not about Perl 6.3.
3. Why did O'Reilly even bother with this?
You sir, are a f'in nutcase, that or I hope this was meant to be parody. /. is such a perl-centric place) he get's modded troll while you're "informative". what gives??
so the guy doesn't like the same scripting language as you do. big deal! he made his points the same as you did, but (probably because
I was writing in a combination of Java and Perl on a Linux system. PHP is a wonderful scripting language to work with. While Java forced me to write clean code, the clean Java code sucked up memory and was slower than molasses on my Apache 1.3.26 server running Resin. I had to dumb down my Java code to speed it up. When I did that, the cleanness of Java went away.
What I miss about Perl is being able to write obfuscated spagetti code so unreadable that I had no idea how the code functioned 3 months later.
I also miss all of the broken and largely alpha and pre-beta modules on CPAN.
Can someone tell me if there is a perl to java code converter out there? Open source or proprietary is fine....
If not can someone tell me what the difficulty in writing one would be?
Will it be released at the same time as HURD?
No electrons were harmed creating this post, though some may have been subjected to electrical and/or magnetic fields.
...interesting if true.
I think the plan is important in the sense that the it gives members of the community an idea of what's going to happen who haven't been following it that close.
As far as delving into the guts, yes there is a book about the innards of perl5 Extending and Embedding Perl. A good read actually. I myself am looking forward to a refactored implementation. perl5 isn't too pretty inside the bowels.
-William Shatner can be neither created nor destroyed.
Yeah! 'cuz if we don't write all our software in the same language, the OSS movement is doomed!
WTF are you talking about? Divide the community... it's about the software, not the language. Who gives a damn if the code is written in Perl, Python, Ruby, or, heck, shell script, as long as it does something useful?
My website (hosted by windows 2k/IIS) uses perl.
:-)
That's really sick.
That's like using IE on *nix/Wine.
I've given Bookpool.com thousands of dollars worth of business over the years, and never once had a problem with an order.
Perl 6 is a Second System.
Write a glowing review, and post a link and watch the balance in your affiliate account grow! What's wrong with making some spare change on the side? Except, the original review is tainted - it can't be objective because the author has something to gain.
Did you know that many retail stores make more income off the interest on their credit cards than they do off of what people buy directly out of the store? There are whole industries built on deception - and what they appear to do and what they actually do are two different things. Follow the money and you'll see what they actually do.
If you are looking to convert perl source into java source, then you are probably totally out of luck though.
Yeah... I came to the same conclusion... I would have though someone would have tackled the problem before now though...
Neither are you mate, no, not pretty at all, at all.
Turn my world upside down, hurt my brain, then expect me to shell out .... Oh. Only 18 bucks? Ok then. Never mind.
The Russians have won. They have made the world a cesspool of distrust, greed, fear and hate.
Where should I send you the 200.000 usd? ooouh great master of the universe, gimme a break.
Just rewrite the code, you lazy ass. ;)
You wouldn't want non-OO Perl being directly converted into Java equivalence anyway-- the whole point of OO design is to abstract things and make it easier to maintain and modify the source code after it has been created (software engineering practices). A sloppy program-ported version of your Perl code into JSP or whatever would probably be a NIGHTMARE to support.
$post =~ s/=/\</2;
No, that is print "@array"
I'll thank you for not pondering about the :P
attractiveness of my internals.
-William Shatner can be neither created nor destroyed.
Probably noone. Though, Perl is very common.
:)
The distinction is that it isn't called PERL, it is Perl. There once (a short while) was a Perl ripoff called PERL that was a bit similar, but without all the features that makes a maintainable and secure application possible. If anyone is curious, you could have a look at Acme::Inline::PERL at CPAN, which brings the power of PERL to Perl. Yes, the ACME:: namespace is for sillyness and joke modules.
I buy my books on Book Pool and they always has it for less than Amazon. http://www.bookpool.com/.x/r45rkojm50/ss/1?qs=Perl +6+Essentials+&Go.x=13&Go.y=4&Go=Go
http://slashdot.org/comments.pl?sid=72174&cid=6512 5978 12&ci d=6213534
4 18 187 (read the reply)
http://books.slashdot.org/comments.pl?sid=67
http://slashdot.org/comments.pl?sid=69864&cid=6
get a life, troll.
Tell you what - give me the $200,000 that they've been given and I will write the Perl6 interpreter for them.
How will you write the interpreter for a language that is still being designed? This may be part of why Parrot is going nowhere...there is nowhere well-defined to go!
What's with all the anti-Perl flamebait? It's fine to prefer PHP or Python or whatever, but at least give Perl the credit that it's due. It's fast, really truly cross platform, widely distributed, open source, munges text like nothing else, was the first decent backend to websites, and has a bunch of useful design patterns built into the language.
And regular expressions, too! Like Perl, you may hate the syntax but but you've got to love the power. Ah yes, it's like one of those fire-breathing car-crushing truckosauruses... ugly but mighty. I heart Perl.
(Before you hit reply, yes, I am aware of the bad aspects of Perl. But most of them are optional, and I can live with the ones that aren't.)
Vino, gyno, and techno -Bruce Sterling
But it's here, now. Arguably one of the most cross-platform, complex Open Source application. Just have a little faith with Perl 6. You might not like it, but many will, just like mozilla.
Excellent responce
HenryJamesFeltus.com
Is it not true that most Free Software projects
start small and then pickup exponentially? Debian
had less than 70 develpers for several years,
today there might be 1000 developers. Or, how
about testing the the 2.6 kernel? Most people
do not test the kernel until the release date
gets closer, at which point traffic and bugfixes
also increase exponenttially.
That's Fotango, who deserve a huge thanks from everyone who cares about Perl 6.
Chris
M-x auto-bs-mode
You're a bit confused. Mozilla is not vaporware and never has been. Mozilla actually has a well-defined goal and good leadership. But Parrot/Perl6 is a different story altogether.
Where should I send you the 200.000 usd? ooouh great master of the universe, gimme a break.
Easy - send it here or here. At least they know what they are doing and have concrete results. Their VMs can run any interpreted language you can shake a stick at. No need for Parrot at all.
Is it not true that most Free Software projects
start small and then pickup exponentially?
No, only good free software projects pick up exponential support - most just wither and die. People know a dead horse when they see one. Just check out 99% of the ill-conceived and poorly designed projects on Sourceforge for an example. The previous attempt at Perl6, Topaz, was also a failure. It's on Sourceforge as well, if you care.
a Perl5 book, buy something else.
So what if Perl6 is not ready. If I was interested
in the Unified Theory, I would buy an appropiate book for
the topic; or do I first have to wait until physists
finaly decide whether the theory is valid or
invalid?
Following the Perl 6 development process is a lot like that. You gain some appreciation of how all those indispensible but ultimately hidden services were actually put into place. Then maybe you will be able to use them with a bit more insight and respect.
-- Our systemic servants do not good masters make.
(Please correct me if wrong). As for Perl6,
it is impossible to judge ahead of time, unless
of course, you are too eager to spread FUD, much like Caldera,
and you keep your reasons a secret.
I have taken the trouble to study the Perl6
features, and I even know Parrot Assembly, not
to mention that many Perl6 features have
been available as Perl5 for years! I am still
waiting to hear why the project is ill conceived,
which unlike Topaz, it enjoys the support of
most p5p (perl porters), they are the very
same people who wrote perl5. If anything, the
past history is a one of atchivement and success,
not (as you claim) one of failure.
there was an attempt to rewrite the kernel
in C++. Although that attempt was a failure, did Linux
turned out to be a failure?
We will judge when it arrives. I am just suspisious
of people who arrive to speak ill about other
people's projects before completion, especially,
when these people have a prior record
of achivement.
> Perl is old news.
:-D. Yeah. Well with Parrot, you'll be able to write your super-high-level code that doesn't need to worry about such things in Ruby, but then write your lower-level code in a language which gives you more control, and compile it all down to Parrot byte code. I expect that Perl 6 will allow a bit more optimisation that Ruby does.
>
> Ruby.
Personally I love Ruby. It's great fun to program in. There's one thing I don't like about it, though: anytime you want to do ANYTHING, you have to do a method call. That means you have to take some object, and look through one or more hash tables of method names => methods. You can't evel 'call' a piece of code without looking up its 'call' method. I'm sure that hurts efficiency quite a bit. What would be nice would be to use Parrot-style vtables for common operations like get-subelement, get-attribute, call, etc. (however I think Parrot's gone a little overboard with the huge Vtables... Maybe there should be a 'mini' version of the Vtables or something...) So instead of saying
object.call('param1','param2',etc)
you could say (assuming 'CALL' is some kind of keyword)
CALL(object,'param1','param2')
or maybe even
object.CALL('param1','param2')
'CALL' would be recognised by the compiler as a lower-level method call. No method names to deal with, so it's much faster
Sorry. That was incoherent (ant? whatever) and vaguely off-topic. Mmeh.
Duct tape, XML, democracy: Not doing the job? Use more.
If Perl is old then Ruby's just a baby.
Ruby says "bwarghhhhh!"
Karma: Bad due to google bombing - Robert Watkins woz 'ere.
The ideas in Perl6 (the language) are quite interesting and many people within the Perl community are looking forward to it. I also look forward to it. It is important to distinguish Perl6 from Parrot. Strictly speaking, Perl6 (the language) does not need Parrot at all. It is simply one possible way to create Perl6. I believe Parrot is needlessly delaying the progress of Perl6.
Perl6 should be written first in Perl5 as a proof of concept - eating their own dogfood and all that. They could then run actual Perl6 code, find problems, sort out issues and even bootstrap Perl6 within Perl6 itself. Most high level languages are developed in this fashion. They should only consider rewriting Perl6 in C for speed reasons once the design of the language is sound. How can anyone expect a reasonable design for an interpreter when the language is not finished? Having a high-level Perl6 interpreter available written in Perl5 (or Perl6) could help facilitate the targetting of Perl6 towards any number of interpreter VMs including the JVM and the CLR (Mono and DotGNU). Let the best VM win. Heck, having multiple back-ends for Perl6 would be a good thing as well.
I question the process and priorities of the Perl6 project, that's all. Surely such issues should be discussed after two years of effort without significant milestones being achieved.
By the way, Topaz was originally going to be named Perl 6.0. Perl6's name was rebranded to be the next generation Perl after Topaz's failure.
One more thing: sometime around Linux-kernel 1.4,
there was an attempt to rewrite the kernel
in C++. Although that attempt was a failure, did Linux
turned out to be a failure?
I could not agree with you more.
That is exactly why Perl 6 should abandon Parrot in favor of a better design strategy (as outlined in a previous post in this discussion thread).
Hybrid solutions always the best
mount /dev/mare
Not to mention the mare trolls aren't your design! (but feel free to use them, you see, mare sex is such a wonderful activity that it definitely needs some promotion in popular places like this... :)
Good day.
It is I who stand corrected!
Yours humbly,
Ta bù shì dà yú
XML is like violence. If it doesn't solve the problem, use more.
> Debian had less than 70 develpers for several years
Debbie and Ian had a working distro in less than one year. What has parrot begotten?