by Vicky Brown
Damian Conway is a Senior Lecturer within the School of Computer Science and Software Engineering at Monash University in Melbourne, Australia. He is the author of several Perl modules, including the prize-winning Coy (a Haiku error message module :-). He is also the author of the book, Object Oriented Perl, published by Manning this past summer.
Damian is an interesting person to talk to and... he's a MacPerl user. I thought it would be fun to do an interview, to show that "real" people use MacPerl. Through the magic of the Internet, this interview was made possible even though I am usually sleeping when Damian is up and around :-)
How long have you been using Perl?
According to my records, I wrote my first Perl program – an encoder for stuffing structured CGI data into a flat NDBM database – on November 12, 1996. Call it three years.
Why did you decide to use Perl?
Well my previous attempt to bolt a multi-platform database onto a dynamically generated web form had involved many hundreds of lines of rather nasty C++. That I could solve the same problem in 34 lines of Perl told me something.
What do you like about Perl?
Phew, where do I begin? I like the way it fits into my brain. I like the fact that I can think in Perl more easily than I can in any other language. I like the sophistication of its fundamental data structures, which take care of most of the hard bits of any given implementation. I like having access to the interpreter at compile- time and to the symbol table at run-time. I like the way I can extend the language with modules, ties, AUTOLOADs, etc. to make it do what I need (instead of what some language designer thought would be good for me). I like its genuine portability. I like that there is a vast array of modules available via the CPAN (why waste time reinventing the wheel, when you could be reinventing the engine?) I like its almost non-existent OO model, which doesn't get in the way of an OO design. I like the way the language has evolved to meet the needs of its users without ever losing its essential personality.
But more than anything else, I like the members of the Perl community. They're unruly, undisciplined, argumentative, pedantic, opinionated, intense, passionate, clever, funny, helpful, generous, and sometimes even wise. And I feel more at home amongst them than in any other technical or social group I've ever known.
What do you wish would change?
About the language? Well many of the things I've been longing for are about to appear in version 5.6. Most specifically, I'm looking forward to lvalue subroutines, lexical warnings, and faster method calls.
I do wish that prototypes could be fixed, so that it were possible to write subroutines that emulate *all* of Perl's built-in functions. I also wish they'd call them something other than prototypes – say, "argument context specifiers" – so that people wouldn't expect them to act like parameter definitions.
I'd also like to see a prototype that specifies lazy evaluation of the corresponding argument. That would be a very powerful tool.
But if I could have only one wish, it would be for pattern matching on input streams. I'd love to be able to specify a match directly on a typeglob or filehandle:
*STDIN =~ /pattern/;
and have the regex engine seek up and down the stream to read in only as much data as it finally needs to match.
Of course, since I refuse to code in C anymore – and hence can't patch the core myself – I have no right to expect any changes! But it's nice to dream.
How long have you been using MacPerl?
I started using MacPerl in May 1998, when I wrote a little program to batch convert Mac \r's to Unix \n's.
What do you use MacPerl for?
I guess it's a trite answer, but I mainly use it as glue. That is, I use it to coordinate AppleScript-aware applications, or to script interactions between other Mac software – typically between PowerPoint and the real world. Come to think of it, if Perl had nothing else going for it, allowing me to avoid Visual Basic would be enough!
I also use MacPerl to do plaintext processing on my PowerBook. Being born and raised a Unix hacker, sometimes I go to reach for grep or sed and it isn't there. Fortunately, it only takes a few moments to whip up an equivalent (or better!) Perl program.
What is your favorite Perl module?
Without doubt, it's Data::Dumper. I'm forever playing with persistence and code generation, and Data::Dumper's invaluable for both.
What made you decide to write Object Oriented Perl?
Manning made me an offer I couldn't refuse: "Write us a book and we will give you money."
But seriously, I've spent a good many years teaching object- orientation using unforgiving languages like C++ and Eiffel, and I was tired of the comparatively bad rap that Perl's OO model gets (both within and outside the Perl community). I really wanted to show the nay-sayers how elegant and powerful OO Perl can be.
Is it true that it was written in four months?
More or less. I started writing in November 1998 and delivered the final draft in April 1999. I had a month's summer vacation in the middle, which left about 17 weeks of writing. Of course, after the final draft was in there were several revisions as the many technical editors and proof-readers sent their feedback.
What was it like having Tom Christiansen proof your manuscript?
That was easily the scariest and most rewarding part of the whole experience. Of course, back then I didn't know what a gentleman Tom is, so all I had to go by was his fearsome reputation. Naturally I was nervous.
But Tom was wonderful: supportive, astonishingly generous with his time, but also uncompromising in his expectations. He dissected every line of the manuscript, offering suggestions on both the Perl and the prose. It's a vastly better book for his input.
And he wasn't the only Perl wizard to do that! Randal also ploughed through the whole thing and threw back some really curly questions. Ilya carefully vetted the chapter on overloading. Tim Bunce helped out with the DBI bits of the persistence chapter. Graham Barr and Chris Nandor gave some of the most complex chapters a close going- over. Uri Guttman re-read the entire final manuscript during typesetting and caught a couple of serious glitches at the very last moment.
There were many other well-known helpers too (they're all listed at Manning's website). All of them were busy, but all of them were willing to find time to help a relatively unknown antipodean academic. That's what I mean about the community being the best part of Perl.
Did most of the examples run under MacPerl?
Yes they did. In fact, I did most of my development and testing on my Mac. After all, with a G3 under the hood it's three times faster than my Unix box.
Of course, some of the 5.005-specific features – precompiled regular expressions, pseudo-hashes, threading, reblessing in DESTROY, and some of the newer features of tied arrays and filehandles – weren't available, so I couldn't use MacPerl for them.
Did you have any doubts?
That the code would work under MacPerl? None at all. As I said, most of it was developed on a Mac. I was writing the manuscript in MSWord (DON'T ASK!) on my PowerBook, so it was usually easier just to fire up MacPerl and cut-and-paste the sample code straight away.
How does it feel to be asked to sign your book for people?
Really, really odd. I'm more than happy to do it when asked – I take it as an enormous compliment – but I still don't understand why people want my signature. Larry's or Tom's or Randal's, sure. Or I could understand them wanting Sarathy to sign their ActiveState CD.
How does it feel being the two-time winner of the Larry Wall award for Practical Perl?
Hmmmm, that's another thing that feels really strange.
I feel like an amateur golfer finally playing in the big leagues, who steps up to the first tee, swings, and hits a hole-in-one. Everyone congratulates him, but he and they all know that it was an utter fluke. Then at the second tee he hits another hole-in-one! People start looking at him differently, even warily. And now he's scared, because everyone knows he's on a hat trick, and he's deeply aware that he might not hit a hole-in-one next time!
Apart from that angst, I feel very humble to have had my work recognized in this way. There are so many talented and creative people contributing to Perl these days, that to be awarded for "elegant, powerful, appealing, intelligent, clever, imaginative, beautiful, surprising, or cunning code" is a remarkable honour.
Your 1999 award was for Coy: haiku error messages in Perl!
Yes, it's clearly an obscure or archaic sense of the word "Practical".
You know, that's just what I asked myself constantly as I struggled to get any sense out of the various Coy prototypes. I guess I answered that question best in an article in the latest edition of The Perl Journal:
I often think of
Perl programs as the haiku
of the software world.
Both are compact, dense,
powerful, and frequently
a little obscure
(Hmmm...wait a minute...
that's also a fairly good
description of me!)
I love the mirror-like nature of haiku – that the meaning you find in them is a reflection of you, not the haiku.
You wrote the entire paper in haiku. What made you decide to do that?
This year the committee (in a desperate act of self-preservation) asked authors to submit extended abstracts rather than full papers. So I was trying to find a way to condense a large amount of technical detail into about 1000 words. Since haiku are a very powerful form of "thought compression", they were the obvious way to summarize the paper. And, of course, the self-referential aspect was cute. The compression worked well too. In the end I only needed about 40 haiku – less than 400 words.
From there, the whole thing just got out of hand. Nat liked the idea of my doing the whole paper in haiku, so I did. Then it seemed inconsistent not to rewrite the module documentation that way too. At that point the die was cast, so when people wanted web pages and journal articles, there was nothing for it but to write them in haiku as well.
Would you do it again?
No. It wouldn't be interesting a second time.
Besides, writing in 17-syllable chunks is hard. There's no obvious rhythm that a native English speaker can latch onto, and it's particularly difficult to get any sense of flow running between the haiku.
It was a tremendously valuable exercise in writing discipline, but like other forms of discipline, I wouldn't generally recommend it. Unless your predilections run in that direction, of course. ;-)
You're not the normal college professor, are you?
I like to think not.
Not that there's anything wrong with normal college professors. Why, some of my best friends are normal! It's just the thought of spending 20 years becoming the world expert in some impossibly specialized domain - sonar adaptations in the syrinx of the Venezuelan oil bird, for example - has absolutely no appeal to me.
I'm just the opposite. In the last three years, for example, I've done research in programming language design, programmer education, software engineering, multiple dispatch, morphing, facial animation, geometric modelling, the psychophysics of perception, nanoscale simulation, cellular automata, natural language generation, and self-modifying parsers.
It's one of those "Yes Minister" irregular verbs:
- I am a polymath.
- You are a dilettante.
- He has a pitifully short attention span.
I heard that an academic colleague once told you that you were "throwing away your career to go hacking". Is that true?
Yes indeed. I'm sure it was meant kindly, though.
Was he right?
The jury's still out on that one. It was looking rather grim until I won the back-to-back "Larrys", and wrote Object Oriented Perl. Prizes and books go down well in academia. I guess we'll really find out in a few years time when I'm up for my Associate Professorship.
So why do you choose to stay in academia (i.e. live in poverty)?
I'm addicted to the freedom.
What other job is going to allow me to flit between a dozen unrelated projects, develop and support numerous Perl modules, indulge my love of teaching, be paid to continue learning, travel overseas to conferences every year, read books, write books, and still keep weird, hackerish hours?
Sure, I'd like to be earning 5 times as much out in the real world, but not if it meant I could only be 1/5 as happy. That's not a good tradeoff.
You've written and presented quite a few research papers, on varied subjects, from C++ syntax to English pluralization. Which would you say was your favorite? Why?
I think my favourite was the paper on resyntaxing C++ . Mainly because it was a heroic exercise in futility. Ben Werther and I knew we had a better syntax for C++ – easier to write, easier to read, easier to parse, even backwards compatible – and at the same time we knew that we had absolutely no hope of getting it accepted. We were shot down in flames, but at least we had the satisfaction of being right!
What's your current area of research interest? What are you working on now?
As usual, I'm juggling half a dozen projects. Top of the list is the long-awaited release of Parse::RecDescent 2.0. At the same time, I'm alpha testing a module that implements an OO Design-by-Contract scheme in Perl. I'm also interested in extending my SQ-HAL system for building SQL queries from natural language questions.
Then there are three or four "Special Projects" that will become papers for TPC 4.0. Can't reveal too much about those just yet – let's just say I'm practising my golf swing.
Is there another book in the works?
Actually, there are several. Graham Barr and I are currently negotiating with O'Reilly to write a book on network programming in Perl. And I'll also be writing a textbook on advanced C++ programming, probably for Manning. I have several other ideas too – all hampered by a severe lack of tuits, of course.
Amazon.com interviewed you a while back... What was the best question they asked you?
They asked me whether people need to approach object orientation in Perl with a different mind-set than they're used to with other OO languages. I told them that one of Perl's strengths is that you don't need to adopt a different mind-set because Perl will generally let you program in almost any style you're used to.
But I went on to point out that, by programming in Perl, you'll almost certainly evolve a different mind-set, because Perl's power, flexibility, and TMTOWTDI philosophy allow you to constantly extend yourself as a programmer.
What should I ask that Amazon.com didn't?
They should have asked me which of my own modules is my favourite.
So, which of your own modules is your favorite?
I'm glad you asked me that.
I'd have to say that it's a line ball between Coy and Lingua::EN::Inflect. Coy's the obvious choice and I am very proud of it, but Lingua::EN::Inflect was the more deeply satisfying of the two. It solves a series of trivial but epidemic problems in natural language generation: plural agreement, indefinite article inflection, participle formation, converting numbers to ordinals or words, etc.
Of course, neither module is a cure for cancer, but I like to think that each of them might be contributing to the universal good in a small way, if only by momentarily reducing someone's stress levels.
Some readers may want a little personal color.
They should really be more careful what they wish for.
Your Monash home page claims you once leg pressed 1765 lbs. That can't possibly be right, can it?
Depends how you look at it, I guess. It's certainly true that I once put 800kg of plates on a leg press machine, and pressed them ten times. Of course, it was an 45-degree inclined leg press machine, so there's an implicit √2 factor in there. That makes the exercise equivalent to vertically lifting only around 1250 lbs.
It all came about because I read some ancient science fiction story – Doc Smith or Larry Niven, I think – where the steely-eyed hero is trapped helplessly in his chair aboard a spaceship accelerating at 6 gravities. That sounded fishy to me. Runners regularly sustain instantaneous accelerations higher than that when their heels hit the ground, so I figured that it ought to be possible to stand up carefully under such a load. Turns out it is.
In one of your talks at TPC 3.0 you listed a dozen ways you were identical to Tuomas Lukka. How many were true?
Well, let's look at the list and you decide:
- Native of remote country with extreme climate
- Academic with interests in OO, parsing, and compilation
- PhD unrelated to programming
- Blue eyes
- Rugged good looks
- Sexy, but hard-to-understand accent
- Partner is a statuesque blonde beauty
- Author of numerous CPAN modules
- Had two papers in TPC 2.0
- Author of book on OO Perl
- Paper(s) in TPC 3.0 based on chapter(s) from said book
I'd say in my case you'd have to say everything but the looks and the sexy accent. In Tuomas's case, I guess you'd have to concede that he's not yet the author of a book on OO Perl. ;-)
What do usually eat for breakfast? :-)
This is where my predominantly Celtic genes really assert themselves – every morning I rise at 5.30 and have a large bowl of steaming porridge. It's the perfect breakfast: it provides essential carbohydrates, vitamins, and fibre, as well as the comfort of knowing that nothing worse can happen to you all day!
Do you have any hobbies you'd like to tell the readers about?
Hmmmm. I've never really been a hobby person, never really had the time. In some ways I suppose hacking is my hobby – I'm just fortunate enough to be paid to do it.
But nothing recreational? Music? Reading? Stamps? Model trains?
Okay, Brown, you wrung it out of me! I confess...I collect trivia.
That's right, I admit it: I know which of the Wright brothers flew first (it was the younger one). I know why La Paz has the lowest incidence of house fires of any world capital (for the same reason it will be one of the few world capitals unaffected by the looming environmental threat of eustasy). I know Rasputin's patronym; who had the largest funeral in history (not Princess Diana); how Dr Martin Luther King helped with the casting of Star Trek; the event for which Hong Kong won its only ever Olympic gold medal; what type of container you need to store liquid boron; who first proposed the common descent of homo sapiens and the other great apes (no, it wasn't Darwin).
What can I say? It's both an addiction and an affliction!
Do you have any advice to to give to programmers who are new to Perl/MacPerl?
If you're new to Perl, the best advice that I can offer is to read, read, read. Read the documentation, read the tutorials, read the FAQs.
Then get a good book or three and read them too.
Read the newsgroups too. Lurk a while. You'll learn a lot about Perl and also get a feel for how the groups work, and how *not* to make a bad first impression. If nothing else, read Nat Torkington's twice- weekly FAQ posting before you dive into the melee.
There's a phenomenal amount of help and good advice available to you. Reach out and grab it!