Thursday, April 19, 2007

Goodbye Perl, Hello Ruby

I think I've finally kicked the Perl habit. Perl was a great language in its day, and (as with most CS people who have done empirical research) it played an important role in the data munging aspects of my research and professional life. However, simpler and better languages---Python and Ruby---now exist.

I've been working on learning Ruby for a while now, and using it as a case study in a programming languages class I'm teaching provided the final impetus to learn it "for real". Ruby takes the Perl features I know and love and fits them into a simple and elegant object-oriented model. I think this is the essential distinction between Ruby and Perl. Ruby has objects as a unifying concept, while Perl has no unifying concept. I can explain Ruby to students and feel I'm showing them how to think in terms of objects. Explaining Perl to students feels dirty by comparision.

I know Perl6 is going to appear at some point, and will contain such goodies as a real object model, but I think the ship has sailed.

Speaking of Perl6, I looked into the Parrot VM a while back, since I'm interested in the implementation of dynamic OO languages. All I can say at this point is it's a surprisingly complex design. In comparison, YARV, which is slated to become the official Ruby interpreter, looks much simpler. From a quick glace at the YARV instruction table, it looks quite a bit like Java bytecode.

No comments: