All programming languages suck.
Nov. 10th, 2010 12:18 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
This post is brought to you by recent excursions in The Lacuna Expanse. You can probably skip this post and go straight there, unless you're a perl weenie. If you *are* a perl weenie, you may enjoy TLE. Not only is their API published and well documented, they encourage scripting and bot writing. You could, legitimately, write a bot to run your entire empire, and never log in again, and they'd be cool with that.
Anyway.
I have never been a fan of perl's map function.
There. I've said it. It confuses me, and makes me feel stupid. Partly, of course, this is self-fulfilling - I don't like it, so I don't use it, so I don't understand it when I see it, so I fear it, so I don't like it ....
Working in Lisp a bit recently has, oddly, increased both my understanding *and* my dislike. So I'd like to be educated.
Dear perl hackers. Does map give me *anything* other than syntactic sugar, or perhaps the opposite?
Part of this stems from recently getting up to speed with Python, which has Only One Way To Do It, which means, when you see It, you know exactly what It Is Doing. I've been reading a lot of other people's perl lately, some of it quite old and crufty, and I'm struck by the tendency of perl hackers to be clever. And that's nice, and all, but sometimes it's not. And oh, I know, the community is diverse and all, but it does my head in to go to "help" communities that emphasise clear and readable code, and then say "And you know that annoying 4 line foreach loop? You can replace it with a single line of incomprehensible punctuation using map, in case carriage return is expensive on your machine!".
Which said, I may be missing something. Should I be using map, and if so, why? What does it give me other than shorter code? Do you find it just as easy to parse as a nice foreach loop, or can you do things with it that you just couldn't do with foreach?
On a related note, I think this has something to do with my innate distrust of "$_". I know, I know, "$_" is a defining characteristic of the language, but still. It's *clever*, and I don't always like clever. So map not only generally has $_ scattered throughout, but by definition, when reading it, you get to $_ before you have *any* idea what actual set the map is working on.
This, I suppose, is why I no longer code for a living, but I wonder how much of it really does just have to do with perl.
Anyway.
I have never been a fan of perl's map function.
There. I've said it. It confuses me, and makes me feel stupid. Partly, of course, this is self-fulfilling - I don't like it, so I don't use it, so I don't understand it when I see it, so I fear it, so I don't like it ....
Working in Lisp a bit recently has, oddly, increased both my understanding *and* my dislike. So I'd like to be educated.
Dear perl hackers. Does map give me *anything* other than syntactic sugar, or perhaps the opposite?
Part of this stems from recently getting up to speed with Python, which has Only One Way To Do It, which means, when you see It, you know exactly what It Is Doing. I've been reading a lot of other people's perl lately, some of it quite old and crufty, and I'm struck by the tendency of perl hackers to be clever. And that's nice, and all, but sometimes it's not. And oh, I know, the community is diverse and all, but it does my head in to go to "help" communities that emphasise clear and readable code, and then say "And you know that annoying 4 line foreach loop? You can replace it with a single line of incomprehensible punctuation using map, in case carriage return is expensive on your machine!".
Which said, I may be missing something. Should I be using map, and if so, why? What does it give me other than shorter code? Do you find it just as easy to parse as a nice foreach loop, or can you do things with it that you just couldn't do with foreach?
On a related note, I think this has something to do with my innate distrust of "$_". I know, I know, "$_" is a defining characteristic of the language, but still. It's *clever*, and I don't always like clever. So map not only generally has $_ scattered throughout, but by definition, when reading it, you get to $_ before you have *any* idea what actual set the map is working on.
This, I suppose, is why I no longer code for a living, but I wonder how much of it really does just have to do with perl.
(no subject)
Date: 2010-11-13 10:33 am (UTC)As for the times and places for different programming languages, well, I'll obviously defer to your thoughts there. Although their spread does have a lot the same properties - ie, they generally tend to move with colonisation rather than necessarily being "better" or more appropriate. You need to be good enough, and have a vector of propagation and colonisation.
(no subject)
Date: 2010-11-13 11:05 am (UTC)(no subject)
Date: 2010-11-13 11:11 am (UTC)(no subject)
Date: 2010-11-13 12:16 pm (UTC)I'm fairly sure the argument is that with many other empire-conquest languages, you either get creoles between the empire-lingo and local-lingo which then develop into their own "proper" language, or you actually wind up with both in common usage and they remain distinct... whereas with English it's been a little more common to wind up with heavy English usage by the conquered including loss of local language quite quickly. It's all messy though and all reverse reasoning... not anything anyone can really prove. :-) But yes, conquest/colonisation definitely plays a big part in the spread.
I do agree, many programming languages are definitely popular "just because everyone uses them" for a particular field, not necessarily because that one is better than the available alternatives. Enterprise Java, PHP Web "programming", unix shell scripting, Flash web games... Yech. :-) All have much better alternatives, but they've got a lot of entrenched usage and so they'll all be around a good long while.