[Haskell-cafe] Line noise
Ketil Malde
ketil at malde.org
Mon Sep 22 06:46:20 EDT 2008
Andrew Coppin <andrewcoppin at btinternet.com> writes:
>>> Idiomatic Haskell seems to consist *only* of single-letter variable
>>> names.
Good thing, too.
> Well, qsort (element : list) would be maximally intuitive, but who's
> going to implement it like that? ;-)
Why not listElement : restOfList ?
The rationale for having long names is that you have too many names,
and too large a scope to keep track of them all in your head. Needing
long names is a symptom that your code is too complex, and that you
should refactor it.
The other problem with "descriptive" names is that it is not
automatically checked by the compiler, and thus it often ends up being
misleading. Incorrect documentation is worse than no documentation.
> qsort:: (Ord x) => [x] -> [x]
>
> Nobody is going to realise that "[x]" means a list.
And C is utterly incomprehensible, since from my Pascal background, I
just *know* that curly braces denote comments. Come on, expecting
somebody to understand a language without an extremely basic
understanding of fundamental syntactical constructs is futile.
> well you can see why people are getting lost! ;-)
Yes, by refusing to adapt to any syntax but the single one they know.
> Only if you can figure out that "Map" means what every other
> programming language on the face of the Earth calls a
> "dictionary". (This took me a while!)
Except for where it is called an "associative array" or "hash table"?
Terminology is inconsistent, Haskell happens to draw more of it from
math than from other programming languages.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list