[Haskell-cafe] Comma in the front

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Thu Jul 13 05:09:03 EDT 2006


On 2006-07-13 at 02:29BST "Neil Mitchell" wrote:
> Hi,
> 
> > Are cool kids supposed to put the comma in front like this?
> Some cool kids do, some cool kids don't. Some do both, depending on their mood.
> 
> The advantage of a leading , is that now the comma's line up, and if
> you want to add an item on the end of a list
> 
>   [a
>   ,b
>   ,c
>   ]
> 
> It's just a one line change, whereas with the comma after, you'd have
> to change the previous line as well - which is more effort and gives
> more noise in the darcs copy.

This is one of my pet hates.  First, people find things
easier to read if they are in a form that they have
encountered lots of times before (in addition to
psycho-visual factors). I'd like to think that Haskell
programmers read a lot of literature (and since they should
have started reading this long before they learnt to
programme, and continue so to read, they're going to have
read more literature than code). So for me (and anyone else
moderately literate) a list written

[a,
 b,
 c
]

is easier to read and, (for folk who read from left to
right) gives emphasis to the important parts rather than the
punctuation. (Of course, a list with elements that short
would just be written [a, b, c] anyway.)

Now, you argue that it's more effort to add (or delete)
items from lists in this form, and maybe you are right (I do
it by dragging my mouse over stuff I want to remove, so
start with the comma and go down; it doesn't seem too
hard. If you want keystroke commands, you want something
that respects the syntax). The thing is, making
modifications that change the meaning /ought/ to be
effortful. If you can delete things without thinking about
it, you're probably going to delete something you shouldn't.

Then the argument from darcs -- well, historically diff is
line based, which was fine in the days of punch-cards, but
makes much less sense nowadays.  Ideally the diff darcs uses
should be syntax driven -- a nice project for someone; we
can save effort by only doing this for Haskell, and leave
programmers in other languages stuck with line-by-line
diffs.


 Jón

-- 
Jón Fairbairn                              Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list