This part of the thread is probably better as an advocacy discussion.
>From: Chip Salzenberg <chip@[EMAIL PROTECTED]
>
>The OP complained about Perl's expressive freedom. Take that away and
you
>don't have Perl any more. In short, he *is* wrong.
I am firmly in favor of expressive freedom, but I don't think it's the
only thing. There's a tension--not a contradiction--between expression and
communication. I'm going to grit my teeth and quote myself on an unrelated
subject:
"A fair number of bloggers (and poets) write only to express themselves.
If the writer is satisfied with the results, there's literally no
criticism which can be made of such writing, since it isn't written for
anyone but the writer. There's no such thing as bad technique in
masturbation--whatever gets you through the night is all right, or
alright, or Madeline Albright. I make no judgements.
"However, writing which is intended to communicate to even one other human
being (hell, this is true of code passed to a computer or commands spoken
to a dog) has a larger purpose and is therefore held--rightfully!--to a
higher standard."
Here's an exchange between Tom (the original poster) and Juerd that I
think illustrates the point. Juerd is responding to Tom:
To me, being able to write
open my $fh, '<', $file or die "$file: $!";
instead of
open(my $fh, '<', $file) || die("$file: $!");
is very important. I find the former both easier to write and easier to
read.
> C does indeed suffer from the same problem to some extent, but at
> least all the operators actually mean something different. With perl
> this extra nonsense was added specificly to encourage leaving out
> parens and leaving all but language lawyers scratching their head.
You say that as if leaving out parens is a bad thing. And you probably
think it is, but I disagree. That's exactly why it's important to
support multiple styles. As long as I can read your code, and you can
read mine, why should we both write the same way? I'm much more
productive if I can write things in a way that feels right to *me*, and
any employer wants their people to be productive, right?
<><><><><><><><><><><><><><><><>
First, let me admit that I'd probably write that line like this:
open(my $fh, '<', $file) || die "The file $file could not be opened:
$!";
The parens around the argument to die adds neither meaning nor ease of
comprehension; the parens around the arguments to open do add to ease of
comprehension. (I think. It'd be nice to see an actual experiment
performed to evaluate my opinion.)
Now, whether that's easier for Juerd to read or not matters quite a bit if
Juerd is the only person whose effort in reading that line matters. If a
couple dozen (or a couple hundred) other people have to read that line,
and it takes them on average, oh, ten percent more effort to read Juerd's
way of writing it, an employer who wants their _people_ (not the one
person writing the line, but everyone who works with it) to be productive
will to tell Juerd to spend those two or four extra keystrokes in the
interest of greater readability.
Please note that I'm not saying "|| XOR or" or "|| AND NOT or" or anything
like that (I don't think I _could_ say that three times fast), although I
could make an argument for it. What I am saying is that "it's easier for
me" is a bogus argument.
>If we started "listening" (in the sense you use) to every complaint,
pretty
>soon we wouldn't have a useful tool any more.
I'll get at what I meant by "listening" in a moment, but first:
>We'd have a grade-school art
>project, with everyone's finger painting up on the wall, and nobody
feeling
>justified in praising one work over another, no matter how much better
one
>was than another.
Isn't that exactly what having || and or enable in Perl style?
"Teacher, I don't like putting parens around my arguments!"
"That's okay--here's some '||-out' and a bottle of 'or' paint."
"Oooh--shiny!"
Now, as to what I meant by listening: I meant listening.
I didn't say, "Make every change someone asks for." I didn't say, "Agree
with whatever people say." What I did mean was, "Pay attention! Pay
attention! I'm talking to you and I hope you're concentrating!" for
appropriate values of "I".
The language we need to change is not Perl. It's the language we use in
talking about Perl. In particular, Perl people need to get rid of that
(sigh) chip on their shoulder. (Whereas having Chip on your shoulder could
only help you be a better programmer.) I've heard that tone since I first I
spent time around more experienced Perl programmers, and I'm still
convinced it's one of the reasons neither bottom-up nor top-down Perl
advocacy is all that successful.
So, let's say something new. Here's a start: "I don't have to prove that I
am creative! I don't have to prove that I am creative!"
>Some brains are simply not Perl-compatible. (*cough*ESR*cough*) That's
why
>TMTOWTDI is so great. We can send them off to follow the path of Python
or
>Ruby or whatever, and they're happy (or they think they are). Meanwhile,
we
>feel good about ourselves for our open-mindedness. Win-win! :-)
Oddly enough, I spent part of the last week browsing books on Python and
Ruby in the interest of broadening my horizons. I was about to take them
back to the library, having decided they weren't really for me, but this
thread has me questioning that decision. It's not a brain mismatch, but a
question of cultural survival. At a certain point, the town I lived in no
longer had a place for Hippie Johnny. Of course, they had the wrong man--I
spell my name J-o-h-n-n-i-e.


|