[Haskell-cafe] Comment Syntax

Richard O'Keefe ok at cs.otago.ac.nz
Mon Jun 6 10:21:40 CEST 2011


On 4/06/2011, at 5:12 AM, Andrew Coppin wrote:
> 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.)

Indeed.  The Wikipedia lists
Euphoria, Haskell, SQL, Ada, AppleScript, Eiffel, Lua, and VHDL.

Presumably it was chosen for its resemblance to the em dash.

SNOBOL had a neat hack.  You could begin a comment with any of ⎡⎢⎣
making it possible to write blocks that looked like
⎡ A comment that
⎢ stretches over
⎣ several lines.

APL's "lamp" symbol had the advantage of being wholly new and so
having no prior conflicting uses.  ⍝ has been in Unicode for a
relatively long time.

Bearing in mind that the characters that have been used to begin
end of line comments include *, /, ;, !, #, %, and $, it's not
clear that there's anything _that_ regrettable about "-- ".




More information about the Haskell-Cafe mailing list