Thursday, August 18, 2011

Scripting Language Comparisons

A huge table comparing PHP, Perl, Python, and Ruby (via Jason Kottke).

2 Comments RSS · Twitter

Actually, syntax minutiae isn't all that interesting, so the comparison is kind of a huge waste of bandwidth; it's really looking in the wrong place. What really matters are major architectural facts, like the object model. In Perl, object orientation is bolted on (and can in fact be defined more or less however you like), which is insane. In Python, whoever originally designed the object model didn't understand object orientation: for example, a variable name not found in the object will be sought in the class, destroying the crucial difference between an instance variable and a class variable. Ruby understands all the right distinctions, and you can open any object / class / module dynamically and alter it - and those changes trickle down correctly (change the built-in String class in mid-program and existing strings suddenly start behaving in a new way). Now *that's* a language.

@matt Syntax affects what it’s like to use a language. That Python looks in the class after the instance is an interesting bit of trivia, but I can’t say that it’s lead to me writing code that was cleaner or uglier or had more (or fewer) bugs. Ruby has monkey patching, and Python has multiple inheritance. I suppose there are cases where one or the other is absolutely necessary, but for most day-to-day use I think the syntax matters more.

Secondly, the comparison is a good reference if you need to look up the equivalent feature in another language.

Leave a Comment