This is the first of several entries I’m going to write about what’s wrong with some programming languages I’ve run across. Oddly enough, I’ve chosen the language with which I’m most comfortable to attack first — Perl.
There are two things wrong with Perl:
- List Processing
- Object Oriented Programming
Perl’s problem with list processing is pretty simple, really. Lists don’t nest. Period. If you stick a list inside another list, it’s unfolded into its discrete elements. As a result, instead of one list containing another, you end up with one list containing all the elements of another.
Perl has references, as a kludge to “fix” the list problem. It’s just not good enough. In general, Perl does everything better than PHP (it would be difficult to do them worse), but this is an example of something it does do worse than PHP. At least with PHP you can stick one list inside another. With Perl, you have to do gymnastics and become a contortionist to be able to roughly approximate the ability to nest one list inside another.
With Perl, pretty much everything is easy — except list processing.
Perl was designed as a procedural language. Object-oriented Perl is an afterthought. It’s a pretty broken afterthought. At a glance, it looks “not bad”, but that’s mostly because many programmers think of Visual Basic and C++ as object-oriented languages. Perl’s object oriented features are about on par with C++ (a hair less good for serious OOP), and notably better than VB’s object oriented programming features. OOP might have been tacked onto a procedural language as an afterthought, but at least it wasn’t tacked onto a line-oriented programming language as an afterthought, as happened in VB.
Still . . . you don’t really need object orientation to get things done. Sometimes it helps. Sometimes it doesn’t. When it helps, Perl’s object system is sort of a bad way to go about it.
There are a lot of other things people tend to think are broken in Perl, but as far as I’ve been able to determine the truth is that they’re just things that don’t suit the way these critics think. If Perl doesn’t suit the way you think, use a different language. That doesn’t mean the language is wrong, though — just as a jacket that is three sizes too large or too small for you isn’t wrong. It just fits someone else better.
I suppose there’s one other thing wrong with Perl. It doesn’t come with a compiler for creating optimized binary executables. In general, of course, it’s better off using its current just-in-time compiler, but once in a while it would be nice to be able to create a binary executable, and while it’s nice that it often outperforms Java’s VMs, it would be nicer if it could compete with some of the established traditionally-compiled languages.