The people who know me professionally (even a little) have
probably picked up on the fact that I hate Perl. I spent several years as a
sysadmin, so I come by my Perl aversion honestly.
Don’t get me wrong, it’s a useful language and I found it to
be a very handy tool, but it’s so very easy to make code that even the person
who wrote it isn’t sure what it does. The next day.
Or it could be that I’m a crappy developer. Either’s
possible. Maybe a little from Column A and a little from Column B.
It’s the only language that I’ve seen where your cat can
walk across the keyboard and come up with a valid program. What does it do? We
may never know. It may parse a file for a list of addresses, trigger an ICBM
launch, or create animated gifs of dancing cats, but by gum it’ll run.
Personally, I’m hoping for the dancing cat gifs. Everyone
loves dancing kitties.
My standard quip for why I finally stopped coding Perl is
that in any sane language, to get the length of an array, you do something
along the lines of myArray.length. That may not be exactly how it’s done, but
it will be something similar.
In Perl, you do the following: $myArray = @myArray
You assign the array variable to a scalar variable (single piece of information. Int, char,
etc.). This to me makes zero sense from a logical standpoint.
I made that comment about a week or so ago, and the person I
was talking to said that it makes perfect sense because it’s an implicit type
conversion. (I’m not sure if he was joking or not. I hope, and think, that he
was).
He had a sort of point about implicit type conversion, but that
sort of thing is supposed to follow a logical convention of some kind. For
example, an implicit conversion from int to long makes sense (it’s basically
just shoving existing data into a bigger container).
You could even make the case for implicit conversion between
string and character array data types. I wouldn’t do it, because it’s probably
better done explicitly so you don’t shoot yourself in the foot, but the
argument could be made.
However, using implicit conversion to cast an array to (effectively)
an integer in order to get the length of the array doesn’t make any logical
sense. It’s like buying a chicken because you want a renewable source of
pineapples.
In what non-Euclidian universe does this make sense?
“Well, I just need to figure out how long this array is, so
I’ll assign it to a scalar and HOLY CRAP! THERE’S CTHULHU!”
Ia! Ia! ArrayLength! Fhtagn!
Any language that will summon Cthulhu by simply using it is
probably a bad choice…
Now, if you don’t mind, I’ve got to Great Old One proof my
office.
Current mood: Amused
Current music: Charlie Daniels Band – The Devil Went Down to
Georgia
No comments:
Post a Comment