5 ms·
Ok, but that isn't what you said. You said haskell has way too many operators, and operators are fundamentally unreadable. Neither are true. The problem with
by imanaccount247 12y ago
Ok, but that isn't what you said. You said haskell has way too many operators, and operators are fundamentally unreadable. Neither are true.
The problem with your new argument is that it is just rephrasing "if I don't learn X, I don't understand X". The operators commonly used in haskell are in common use, by definition. Haskell is not unreadable just because you didn't learn how to read it. No, basic_arithmetic_addition_function is not clearer than +. So why would needlessly_long_name_that_conveys_no_extra_information be clearer than >>=?
- sanderjd 12y agoYou know what, you're right. Operators aren't at all "fundamentally unreadable", that was a dumb thing to say. Operators in common usage, like ">>=", are not at all a problem, because as you suggest, they only need to be learned once and aren't easily forgotten. Operators that are never used are also not a problem, because they are never used. But I do see a problem in the middle, where I see an operator, figure out what it does, and then don't see it again for some time. Re-learning less frequently used operators constantly is not very efficient. Your fake names are a false choice. The trick is to find good descriptive names, and using a name that is annoyingly long is probably worse than using one that is frustratingly terse. The trick is to pick a good one.
- codygman 12y ago> Re-learning less frequently used operators constantly is not very efficient. You could also say: > Re-learning less frequently used command line programs constantly is not very efficient. However in my experience re-learning is much easier than learning the first time. For instance if I've used a command line program before I can glance at the manual and figure out what I need very quickly.
- sanderjd 12y agoSure. But my point is that good names make it even easier because they act like a refresher. Unix command line programs could also use to be better-named. "cat" and "ls" are example of fairly poor names (but again, common enough to not be a big problem!), whereas "head", "tail", and "echo" are much better because even if you forget what they do, the names themselves refresh your memory! Naming things well is definitely hard, but it's worthwhile.
- kbenson 12y agoI generally hold that it's simply a matter of whether the language is optimizing for beginners, intermediate level users, or experts. Terse code is useful for domain experts, it allows them to quickly assess what's happening without having to read a lot, and have more of the program logic in the field of view at a time. Unfortunately it's hard for beginners to understand because a lot is implied through idiomatic usage. Verbose code is easier for beginners, but domain experts may find it cumbersome and a chore to both read and write. Perl has found an interesting spot on this spectrum, as through TIMTOWTDI it has the capacity for verbose code, as well as terse, idiomatic code. I'm not sure if that means it's optimized for intermediate level users, or if it's just schizophrenic.
- imanaccount247 12y ago>Your fake names are a false choice Yes, they are certainly hyperbolic. But the idea was to make the point that longer is not better. If a variable has a short scope, you do not need to constantly be reminded what it is. If a variable is very general, a very general name is fine. Generally haskellers consider names like 's' and 'x' and 'i' to be very good names. Code is generally optimized for being read by people who know the language, not by people who are unfamiliar with it.
- sanderjd 12y agoYour single-letter-name examples reminded me of some of the articles awhile back about church numerals, which of course used "s" for "successor" and "z" for "zero". One of the comments on one of those articles was somebody who clearly read the whole article without having a good guess at what "s" or "z" were supposed to mean. I found myself wondering what the point of using "s" and "z" instead of "succ" and "zero" could possibly be, besides some sort of mathematical bravado.
- imanaccount247 12y agoBecause they are easier to read, and make the program clearer. Your anecdote is precisely what I was talking about. It doesn't matter if people who have not yet learned the subject don't understand it. It matters that people who have learned it understand it. People who have learned haskell find short variable names make the easiest to read code.