[Haskell-cafe] Comment Syntax

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sat Jun 4 10:48:43 CEST 2011


Roman Cheplyaka <roma at ro-che.info> writes:

> * Andrew Coppin <andrewcoppin at btinternet.com> [2011-06-03 18:12:04+0100]
>> On 03/06/2011 05:02 PM, Albert Y. C. Lai wrote:
>> >I propose that only {- -} is comment; that is, -- is an operator token
>> >and not a marker of comments.
>> 
>> I'm curious to know why anybody thought that "--" was a good comment
>> marker in the first place. (I'm curious because Haskell isn't the
>> only language to have made this strange choice.)
>
> It is, for my taste, a good comment marker, because of its resemblance
> to a dash. It makes the code look like real text:
>
>   let y = x + 1 -- increment x

And when the language was first defined, there was no real dash
available for this purpose. Nowadays we could use the unicode em
dash (U+2014, "—" if it survices nntp), and free up -- for other
purposes.

Of course, its hard to predict what effect this would have when
people didn't know how to enter it, and although it's quite
distinctive in proportional fonts, the difference between - and
— in monospace fonts is much harder to see.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2010-09-14)




More information about the Haskell-Cafe mailing list