Programming Parrot


Provides an introduction to this new language from the creators of Perl and Python. Not just a comprehensive language reference, it demonstrates advanced programming techniques in Parrot, including programming network clients and servers, software reusability and the use of Parrot on the World Wide Web.

401 pages, $19.95 US / $28.95 CAN.

Today brought the official announcement that many of us in the Perl and Python communities had been awaiting and expecting for some time now: the culmination of the year-long collaboration between Larry Wall and Guido van Rossum, and the establishment of a period of joint development between the developers of Perl and Python.

It's my pleasure and privilege to bring you an exclusive interview with Larry and Guido, where we discuss this exciting announcement.

When did you decide to embark on this idea, and what prompted it?

GvR: We first discussed the idea back in July last year at the Open Source Convention. I was thinking about the changes we'd need in Python 3000...

LW: ..and I was very aware that we needed a big shake-up in Perl and the Perl community. Perl needed to be completely rethought, the language and the community redesigned from scratch. A lot of that happened when we started work on Perl 6. We completely reorganised the development structure, and I was elected to go away and redesign the language.

GvR: So we got together and started talking about the changes that both needed for our languages, and we decided we should try to help each other out, and that's really where the idea for joint development came from.

When you talk about "joint development", what do you mean?

LW: Initially, we thought we could swap technologies in the interpreters themselves. The Perl interpreter's got some really great features: we've got a very fast regular expression engine, we've got very good portability, and we've got a lot of things that could help Python out. Python, on the other hand, has got a great structure. I liked the way it was coded, and it had a lot of other technical things right that we needed: safe signals handling, coherent Unicode support, and so on.

GvR: We also got talking about Microsoft's .NET, and the Common Language Runtime; we agreed it would be a really good idea to try and push our interpreters closer together, so that eventually you'd be able to run Perl and Python bytecode on the same interpreter.

LW: But then when I collected together the change requests - we called them RFCs - for Perl 6, I just couldn't help thinking "Hey, Python's already got a lot of this sorted out".

GvR: Right, and I found that I needed to bring in some things to Python that Perl had had for years, such as nested scopes for variables. So we just brought the ideas together, and we came up with the design of a brand new language.

What about the name of the new language?

GvR: Well, that was my idea. We went over lots of possible names: Chimera, Pylon, Perth, before finally coming up with Parrot. We had a few basic ideas: we wanted it to begin with "P"; it had to be something that wouldn't sound stupid on the end of /usr/bin/.

LW: We also wanted the name of an animal, to represent the combination of the camel and the python. It also helps with the book covers...

GvR: Eventually, I came up with Parrot after thinking about Monty Python's finest hour, the Parrot sketch.

LW: It just sounded right - dynamic, colourful, exotic. I love it!

How did you approach the design?

GvR: We wanted something that both Python programmers and Perl programmers would be right at home with. It had to pull together the best parts of each language. It had to flexible, extensible and elegant.

LW: I think it was quite easy to come up with most of the ideas for the language design; after all, we've both had a lot of experience designing languages and we know what works and what doesn't. The Perl 6 RFCs were also a great help, as an indication of what I thought would work but what actually didn't.

GvR: Fundamentally, a lot of the concepts we had in our languages were identical; it was just a question of deciding on the best ways to put them all together.

Show us some Parrot code.

GvR: Obviously there aren't any full-size Parrot programs available at the moment, just pieces of example code. This is an example written by Tim Peters:
    # copy stdin to stdout, except for lines starting with #
    while left_angle_right_angle:
        if dollar_underscore[0] =eq= "#":
            continue_next;
        }
        print dollar_underscore;
    }
LW: I think this shows exactly what we were trying to achieve: it's immediately obvious to both Perl and Python programmers what that does. We've got a great compromise between Perl's brace-structured blocks and Python's white-space blocks; we've merged the names of language keywords in an elegant way; we've kept the idea of Perl's shortcut variables, but we've combined that with Python's readability.

GvR: Of course, this is just one way you could write that program. There's more than one way to do it, right, Larry?

LW: Sure. I'd probably write the program something like this:

    while(@line = Sys::Stdin->readline()):
        continue_next if $line[0] =eq= "#":
        print @line;
    }

What does this mean for the future of Perl 6 and Py3k development?

LW: This is the future of Perl and Python development!

GvR: Exactly. We're going to be getting our development teams to work together on the Parrot interpreter. Dan Sugalski and Jeremy Hylton are sitting down now to work out how to go forward, how to merge the code that we've already got; we hope to have some results for you by this year's Parrot Conference at the end of July.

What do you think will be the reaction from programmers of your own languages?

LW: I think Perl people will really go for it. All along, Perl has been about taking the best ideas from other languages; we've borrowed from C, awk, the Unix shell, so why should we ignore the most successful of our competitors? It's a perfectly natural move for Perl and for the Perl community, and I'm sure that once they start seriously programming Parrot, they won't go back to Perl. I know I can't.

GvR: I think it'll be a little harder for Python people to accept than Perl people. But then, this is the direction we've been moving in for a while now. Python 2 has had to introduce some features that Perl has had for a long time, such as nested scopes, and there were many other changes I felt we needed to make, all of which were pushing us towards the best features of Perl. But I agree with Larry, I think once Python programmers realise that this is a combination of the best parts of both languages, they'll feel right at home programming Parrot.

Have you heard any reaction from other programming communities?

LW: I got some mail from Matz, uhm, Matsumoto, the creator of Ruby; he said he was delighted, and he'd had a flood of new programmers as both Perl and Python programmers were deciding to get into Ruby.

GvR: Well, yeah; we were expecting some people to get scared off by the idea. It's only natural. Incidentally, John Ousterhout was very interested in what we were doing, but I haven't heard what the Tcl guys think about this.

What do you say to the speculation that this move was influenced by your new employers, the ActiveState corporation?

LW: (laughs) That's pure nonsense. Nonsense, nonsense.

GvR: I can't imagine what you're talking about. (Fnord.)


Programming Parrot, the definitive guide to the Parrot language, will be published by O'Reilly and Associates.