Modern Perl 1
One of the people who make me think that Perl is still worth knowing is chromatic, the ex-editor of O’Reilly’s perl.com. He’s one of the core team who are working to bring the Perl 6 Christmas, a vector of test infection, an extreme programming practitioner and, right now at least, no longer on Giles Bowkett’s christmas card list.
When I wrote the Healthcheck: Perl for (oh ghod, they’ve rebranded) The H, I mentioned that O’Reilly hadn’t announced Perl: The Good Parts yet. This was an allusion to something chromatic had said when I interviewed him for the article – at the time he was pitching that very book, but it seems he got knocked back.
So, he’s writing a book and a blog on Modern Perl, and a jolly good blog it is too. It reads like a manifesto in places, but it’s a good manifesto, so that’s okay. You should read him. If you’re a publisher, you should definitely talk to him. If you’re a ruby programmer, don’t be in the least bit surprised if he’s rude about the ruby community…
Ruby 'til 6 1
Oh, I say. It seems that Sam Ruby is another member of the “Ruby ’til [Perl] 6” club.
I like Ruby a lot. For the kind dynamic OO/Functional coding style that I espouse, it’s a better Perl than Perl simply because it’s so much less verbose (I got so tired of always unpacking the argument list, it tended to put me off applying the Composed Method pattern anywhere near often enough).
But it’s not my One True Language. Perl 6 looks like it might be an awful lot closer to it. If nothing else, it has Lisp style macros.
A good macro system, especially when it’s combined with an accessible and well abstracted runtime is an awfully useful thing. For instance, consider the Rails controller. In a rails controller, public methods are ‘visible’ as actions that can be accessed via the web (usually with a url of the form /:controller/:action). Protected and private methods aren’t accessible in the same way.
But sometimes it’s quite handy to have a method on the controller that shouldn’t be deemed to be an action, but which you might want to call from a model. The canonical example here is when you’re doing Double Dispatch. Here’s an example of bad code:
results = @search_results.collect do |item|
case item
when Comment: extract_comment_metadata(item)
when Trackback: extract_trackback_metadata(item)
else
fail "Oops!"
end
end
Look, we’re using a case statement that dispatches on the class of another object! This is a job for Polymorphism. Let’s assume that the two extract_*_metadata methods need to do some of the things that only a controller can and can’t simply be replaced with extract_metadata on the Comment and Trackback objects. Here’s how I’d rejig the controller code:
The Perl 6 Summary for the week ending 2005-01-09
This week marks Matt Fowles’s first Summary posted on Just A Summary (here’s hoping it won’t be the last). We have been writing the Perl 6 Summary on alternate weeks since early last year when Piers returned from attempting to be a Maths teacher and had the time to write summaries again.
So, here’s Matt’s take on the week, complete with props to a troll. Now we know why the summary was late.
The Perl 6 Summary for the week ending 2006-01-01
Another year, another summary. You might think I’m going to summarize
the events of the whole year, but it turns out that chromatic’s
already done it. So in the spirit of laziness, I’ll just point you at
his year end summary.
http://www.oreillynet.com/pub/wlg/8894
Sadly for us all, he doesn’t go into enough detail on the events of
the last week for me to go straight into the coda. I shall have to
talk to him about next year.
This week sees a big non-technical change in the Pugs camp, lots of
roadmapping and implementation in the Parrot camp, and a more and more
concrete feel of what the language is going to look like in the
perl6-language camp.
Pretty much business as usual really.
The Perl 6 Summary for the week ending 2005-12-18
Welcome to another Perl 6 summary. This has been a week of shootouts,
cleanups, relationships and cunning translations. Read on for the
details (or, this being a summary, pointers to the details).
The Perl 6 Summary for the week ending 2005-12-04
I heard a rumour on the London.pm mailing list week. Apparently the Perl 6 Summaries are no longer being ublished. As I’m sure you can imagine, it came as something of a surprise to me.
This week has been all about Parrot, Leo’s got the new lexical scheme, calling conventions and exception handlers working and made Parrot stricter about arguments. The end of the week saw the release of ‘Luthor’, version 0.4.0 of Parrot.
Read on for more details…
Perl 6 Summary: Week ending 2005-11-27
Another week passes. Another summary is written. Another sentence is written in the passive voice.
Perl 6 Summary for the fortnight ending 2005-11-13
Welcome to another fortnight’s worth of summary. We’ll get back to a weekly
schedule one of these fine days, you see if we don’t.
Back from 'Dam
Well, I’m back from EuroOSCON, which was a pile of fun. I spent most of my time on the ‘hallway track’, occasionally dropping in on interesting talks and keynotes, but mostly just hanging around with interesting people. I took a pile of photos and still have a couple of rolls of film left to develop now I’m back home.
If you’re in Amsterdam and need a professional lab, allow me to recommend Kleurgamma. It’s always a little nerveracking taking negatives to a new lab, but they were exemplary. And they had some fantastic images hanging in their lobby…
Expect more articles about/inspired by the conference soonish.
Packing for EuroOSCON
My new combined laptop and camera bag arrived yesterday, a Crumpler December Quarter. It’s a little snug for my 17" Powerbook, but it’ll serve. The question now is, what cameras do I pack?
