For what is worth, in our project (Ganeti) which has a mixedOn Mon, Oct 29, 2012 at 05:20:20PM +0530, Rustom Mody wrote:
> There was a recent discussion on the python list regarding maximum line
> length.
> It occured to me that beautiful haskell programs tend to be plump (ie have
> long lines) compared to other languages whose programs are 'skinnier'.
> My thoughts on this are at
> http://blog.languager.org/2012/10/layout-imperative-in-functional.html.
>
> Are there more striking examples than the lexer from the standard prelude?
> [Or any other thoughts/opinions :-) ]
Python/Haskell codebase, we're using the same maximum length
(80-but-really-79) in both languages, without any (real) issues.
regards,
iustin
Indeed, I've seen quite a few Haskell projects with long lines.
Personally, I find it hard to read and very irritating. I always use
80-chars lines in my projects.
It seems that people who write long lines mostly come from academic
background, where there's less emphasis on maintainability (no offense;
also, I haven't conducted a proper statistical research — this is just an
impression).
Roman
It is kind of ironic that the wide code examples in the blog post are wrapped at 65 chars by the blog formatting.
Regards,
Malcolm
I'm not viewing on a narrow device, and I see the wrapped (and the whole post confined to the centre of the screen).I certainly don't use an 80-column limit any more. I use the rule:
A function must be completely visible in my editor on my screen. (but this is only a good rule if most people who will be reading the code will also have a similar sized viewport. After all, code is far more often read than written.)And I balance line length with function length.
On the other hand, readable cross-platform text formatting always seems to be a lost cause, as this mail and the referenced blog posting demonstrate.
--
Sent from my Android tablet with K-9 Mail. Please excuse my swyping.
In any language, a line longer than 80 characters usually (but notOn 10/29/2012 07:50 AM, Rustom Mody wrote:
> There was a recent discussion on the python list regarding maximum line
> length.
> It occured to me that beautiful haskell programs tend to be plump (ie
> have long lines) compared to other languages whose programs are 'skinnier'.
> My thoughts on this are at
> http://blog.languager.org/2012/10/layout-imperative-in-functional.html.
>
> Are there more striking examples than the lexer from the standard prelude?
> [Or any other thoughts/opinions :-) ]
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.
"The ideal line length for text layout is based on the physiology of
the human eye… At normal reading distance the arc of the visual field
is only a few inches – about the width of a well-designed column of
text, or about 12 words per line. Research shows that reading slows
and retention rates fall as line length begins to exceed the ideal
width, because the reader then needs to use the muscles of the eye and
neck to track from the end of one line to the beginning of the next
line. If the eye must traverse great distances on the page, the reader
is easily lost and must hunt for the beginning of the next line.
Quantitative studies show that moderate line lengths significantly
increase the legibility of text."
Web Style Guide – Basic Design Principles for Creating Website
Patrick J. Lynch and Sarah Horton
2nd edition, page 97.
+1 to that; I know that it would indeed increase my productivity…
iustin
I tend to look at ONE file at a time, on one fullscreen widescreen.
100 chars per line is more or less normal; I have my vertical line limit marker set to 100, but only for layout-zen. My lines have sometimes 200 chars length, which causes the less important (long) code not to clutter my overview on the >50 neighbouring lines (~10 functions overview on the left half of the screen). Otherwise, I'd use a browser/Haddock on one part of the screen just to see an overview of the code I'm writing.
I'm now wondering, whether this could have sth to do with my ADD, which I had the first 3 decades of my life (and without whiteboard). I think, I should try to code in a small narrow window of 1/4 of my screen, just to test whether that would (still) be a handicap.
Roman: "academic background"... Funny; my impression about this matter was from the other point of view: Short lines are good for diff/patch files.
Are there more people here with ADD (or ADD-history) and long-lines-disorder? Or is that just me?
- marc
-------- Original-Nachricht --------
> Datum: Mon, 29 Oct 2012 11:32:29 -0400
> Von: MightyByte <might...@gmail.com>
> An: Jake McArthur <jake.m...@gmail.com>
> CC: Haskell Cafe <haskel...@haskell.org>
> Betreff: Re: [Haskell-cafe] Optimal line length for haskell
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
(in deutsch: http://www.gerstbach.at/2004/ascii/)
On 30/10/2012, at 3:28 AM, Alexander Solla wrote:
> On Mon, Oct 29, 2012 at 6:52 AM, Michael Orlitzky <mic...@orlitzky.com> wrote:
> In any language, a line longer than 80 characters usually (but notBetter code? I have no idea of what "a wide normal form" might be, and less
> 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?
idea of why that would imply that a narrower and better form does not also
exist.
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.
021346789021346789021346789021346789021346789021346789
On 30/10/2012, at 5:56 PM, Alexander Solla wrote:
> For example, I generally prefer using the combinators directly when dealing with functors, applicatives, and monads. This can be written "wide", but it can also be written in the style of:
>
> > f' = f <$> (a >>= g)
> > <*> (b >>= h)
> > <*> (c >>= i >>= k)
>
> That is perfectly sensible. But if I had to repeat this syntactic construct, I would probably do it wide:
>
> > f' = f <$> (a >>= g) <*> (b >>= h) <*> (c >>= i >>= k)
> > g' = g <$> (d >>= g) <*> (e >>= h) <*> (f >>= i >>= k)
>The trouble is that this is not real code.
> The new row exposes a sort of "tabular" structure.
As it stands, nobody is complaining about this example.
It fits well into 65 columns, being 60 columns wide.
I really would like to see real examples.
Robert Bringhurst's "The Elements of Typographic Style" offers a
similar dictum:
Anything from 45 to 75 characters is widely regarded as a
satisfactory length of line for a single-column page set in a
serifed text face in a text size. The 66-character line
(counting both letters and spaces) is widely regarded as
ideal. For multiple column work, a better average is 40 to 50
characters.
-- http://webtypography.net/Rhythm_and_Proportion/Horizontal_Motion/2.1.2/
I have come to accept 80 characters as a limit that is both in
keeping with programming convention and amenable to the good
taste of typographers. Many respectable software projects honor
this limit and to emulate them, in matters small as well as
large, is to simplify our work in many small ways. Art is long
and life is short.
--
Jason Dusek
pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B