Re: Perl

[prev] [thread] [next] [lurker] [Date index for 2003/09/16]

From: peter (Peter da Silva)
Subject: Re: Perl
Date: 16:33 on 16 Sep 2003
> That's a cute little thing for you to say, but if you have problems reading
> the day-to-day Perl code that I write, no, you don't know Perl.

You seem to be taking this way too bloody personally, because I'm
trying to figure out where I said I had problems reading your code.
So far as I know I haven't seen your code. Not to mention the fact
that you already said you were gonna quit defending this software
I hate and get back (hopefully) to writing about software you hate.

But, whatever, for the sake of discussion I'll concede the point,
it could be that I still don't "know Perl". Given the amount of
time I've spent on it and how much I enjoy hacking languages, if
it's that hard to learn that's a hell of an indictment of the
language.

To illustrate that...

> What, specifically, is the problem?

Foreach, actually. In foreach, but not in any other context, if
you change the temporary variable containing an element of an array
you actually change the array.

I understand why it's done that way, it's useful. Every single
special case in Perl is there because it was a useful exception.
The problem is that any time[1] someone came up with a nifty idea
for a useful exception, it ended up part of the language. The result
is that it's as hard to learn all the exceptions in Perl as it is
to learn all the exceptions in English.

I realise that this was also deliberate.

It's too bad Larry Wall wasn't Finnish or Icelandic, so his idea
of a language would be better suited to programming. Because the
kind of language you need to communicate to an intelligence is
quite different from the kind of language you need to communicate
to an automaton, and English is kind of the Poster Boy of why
exactly that's the case.

In English, it doesn't prevent communication if the rules are
irregular.  If I say "viri" or "virus" you understand what I mean.
If you don't, you can ask me. You don't freak out if I say "verbing
weirds language" or "you from context that can glork", and you
hardly slow down for "You can eevn siwcth ltetrs ardoun and teh
minneag siltl coems trohugh".

In Perl if you do the equivalent, the literal minded compiler will
happily go off and do the wrong thing. And if a construction in
the code is unclear, the reader can't ask the file "do you mean
this or that", he has to go to the documentation to look it up.
That's like trying to carry on a conversation with a dictionary in
one hand and a grammar guide in another (or in the case of Perl,
a dozen pamphlets that never quite have everything you need in one
volume).

Now you go through a phase like that in learning any new programming
language. But compared to learning a human language, it's relatively
short. You can leave the language behind and start learning the
toolkits or libraries. With Perl, instead of having a library to
do a task, that task half the time[1] ends up extending some
undefined case in the syntax of the language in new and exciting
ways. So you have to deal with all the complexity, all the time,
because you never know when you're going to make a horrible pun
and the compiler will laugh hysterically and delete all your files.

I understand why it does that. It makes it linguistically rich and
interesting. Like English.

The problem is, English is a completely insane thing to model a
programming language on. Where we have to write "programs" in
English, we constrict and regularize the language, tighten it until
it creaks, and don't let people use MAY and SHOULD and MUST in
poetic ways. We don't say "the other guy" any more, we say "the
party of the third part". Legal papers and standards documents are
NOT written in the same linguistically rich language as poetry,
because English is a BAD LANGUAGE for writing things that have to
be unambiguous.

Well, you know, a computer program is one of those things that HAS
TO BE UNAMBIGUOUS.

This is why Perl is getting less exotic and more like other languages
as time gies on. Perl 5 is more regular than Perl 4. Perl 6 promises
to be more regular than Perl 5. And that's a GOOD THING. Because
the original design philosophy of Perl was fundamentally wrong,
and it'll only take another five or ten versions for it to get
washed away without Perl Zealots losing so much face they refuse
to go along with the changes.

> Riiiiight, it is a major problem that the code doesn't handle a
> construct almost no one ever uses ...

I think you have cause and effect backwards here.

[1] Yes, I know this is an exaggeration. This is hates-software.com,
not fluffy-bunnies.org.

There's stuff above here

Generated at 14:02 on 01 Jul 2004 by mariachi 0.52