[Haskell-cafe] Optimal line length for haskell
ok at cs.otago.ac.nz
Tue Oct 30 00:09:07 CET 2012
On 30/10/2012, at 3:28 AM, Alexander Solla wrote:
> On Mon, Oct 29, 2012 at 6:52 AM, Michael Orlitzky <michael at orlitzky.com> wrote:
> In any language, a line longer than 80 characters usually (but not
> always) suggests that you might want to stop and rethink your design. In
> many cases a refactoring or two will greatly simplify the code and
> reduce your line length as a result.
> I disagree. That might be true for imperative languages, where width is indicative of deep nesting and its associated problems. But it is not true for a functional language, where it is merely indicative of a wide "normal form". Yes, the normal form can sometimes be refactored, but to what end?
Better code? I have no idea of what "a wide normal form" might be, and less
idea of why that would imply that a narrower and better form does not also
We can argue till everyone is sick and tired and still not reach any
kind of consensus. Let's have some *examples*.
(For the record, the longest line lengths I've ever seen have been in
C++ and Java. I know someone who, and I am not kidding, thinks a 390-
column line in code intended to be read by other people is OK.)
My own perspective is that if I can't fit it onto one slide in large
type for my students to see it is too big.
More information about the Haskell-Cafe