in reply to Re: Think for yourself.
in thread is the use of map in a void context deprecated ?
But I find it hard to believe there are seasoned Perl programmers that have no problem with map if the map is on the right hand side of an assignment, but are suddenly getting confused if they assignment disappears.
Im with the bad style chanters on this one, although a borderline case, I dont froth at the mouth over it, and think the optimisation patch is a worthwhile addition to perl.
I emphasised one point of your comment however. When i see a map in void context that isnt part of an obfu or some CB whip-it-together, my first thought is "Hmm, what happend to the target of the map?" And then I go looking to see what I dont understand. And then I get annoyed and change it to a for loop so that nobody else wastes time trying to figure out the misleading code.
Theres a great experiment for demonstrating this type of principle.
PURPLE GREEN BLACK RED BLUE YELLOW
Now read off the color of each word in the list quickly. Make any mistakes? I bet you did.
And this is the core problem with map in void context. It makes people think that something is happening that isn't, and then when they realize it isn't, they wonder why its not. Its about wasted time. Don't code like that if you work with me, because if I waste any time wondering why that map is there and there isnt a damn good excuse for it then you and I are going to be having an unpleasant conversation. Now if you decide to rework what was formerly a map without changing it to a for, and leave me a note in a comment I wont be so bothered. I probably wont even change the code for you, accepting it under the Shit Happens rule.
# this should be changed to a for, dont worry about it
But if I waste time trying to figure out if the missing part of the map is the cause of some trouble then i'm really not going to be happy.
For me the core of this is that Larry made the language wonderfully expressive so we con convey the maximum information about what we are doing by the constructs we use to do it. Just as languages have nuances and subtleties so too does perl. And when you mean one thing, and then say it in a way that is usually reserved for saying other things then you are potentially and unnecessarily confusing your audience. The cues they are trained to look for are lying to them. Frankly programming is a complex enough job without wondering if the code is lying to me. (It might be fun in obfus and japhs, but it ends there.)
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Think for yourself.
by Abigail-II (Bishop) on Oct 06, 2003 at 19:50 UTC | |
by demerphq (Chancellor) on Oct 06, 2003 at 23:30 UTC | |
by Abigail-II (Bishop) on Oct 07, 2003 at 09:29 UTC | |
by Aristotle (Chancellor) on Oct 07, 2003 at 22:59 UTC | |
by Petruchio (Vicar) on Oct 07, 2003 at 15:07 UTC | |
by Abigail-II (Bishop) on Oct 07, 2003 at 15:24 UTC | |
by Aristotle (Chancellor) on Oct 06, 2003 at 20:08 UTC |