I know that my prefered language, Perl, is Comp. Sci.'s
favorite whipping boy. It causes shame and derision, to the
point that programmers will take up almost any other
language just to avoid the humiliation. But, as my friend,
Jeff, said of his
attempt at Python, What's the point? What can I do with
this that I can't do with Perl?
When people offer their Perl vs. X arguments, it can be good
to look at them to see what they are really saying. Most of the
time, a programmer has already decided which language he likes
(based on various arguments, how he learned programming, etc.)
and the arguments he's putting forth don't really what they say
at face value.
For instance take Paul
Baranowski's arguments in Python
vs. Perl:
| Claim | Comment |
|
Perl doesn't have exceptions. |
Perl does have exceptions, but some
people are not
satisfied with them. Non-core libraries are avaiable that
solve the problem, though.
are available. |
| The code relies heavily on side effects. |
And this is a bad thing, because, why exactly? The side
effects he is talking about are the pronouns Perl uses
($_ is filled in by the runtime), die
acting differently because its DWIM.
|
| There are too many ways to do the same thing in
Perl. |
This argument is used a lot but what does it really mean? If
you are writing your own code, it means nothing. If you are
reading someone elses code, then it usually means nothing. If
you are reading an uber-hacker's code, then this may bite you.
If you are writing your own code: write the way you want. So
what if you could write it more than one way? Write the way you
are comfortable.</p>
If you are reading someone else's code, chances are they've
written it in a way that is trivially understandable. Unless
they are going for job
security (pdf) or they're an
uber-hacker.
But let's face it. You can write obfuscated code in
any language. |
| Unnecessary difference between data types |
It's not clear what is meant by "unnecessary". To a purist,
making a scalar variable's name look different than a function's
name might be uneccessary, but it stems from the philosophy that "different
things should look different" (No. 15 on MacLennan's Language
Principles). |
|
Perl was not made for multithreading |
And yet, it
has threads. |
Now really, this is an unfair rebuttal. Paul says that Perl
vs. Python isn't a fair fight because Perl is 5 years older than
Python. By that same arguement, Lisp should be absolutly
terrible, since the first design for it was developed over 30
years before Python. I say this is an unfair rebuttal
because Paul apparently hasn't really used Perl. And I don't
really expect him to read this and say "Gee, I was so wrong, I'll
start using Perl immediately." If he wants to pick on Perl, he's got
good company. All I ask is that he make his criticism
informed.
Perl isn't for everyone. If you like ivory towers, you shouldn't
use Perl. It's far too organic. It has grown much more than it
has been designed. But plenty of people find it useful. SpamAssassin, slashdot, Request Tracker and
scientists involved in bioinformatics all
use perl. Certainly one of these uses is more serious then shell
scripting.