[Haskell-cafe] Comment Syntax

Albert Y. C. Lai trebla at vex.net
Mon Jun 6 19:08:44 CEST 2011


> 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 "-- ".

Recall that the problem is not with isolated characters, but whole strings.

"-- a" is a comment, "--a" is a comment, but "---a" is not. That is done 
wrong. Either make them all comments, or make them none comments.

"{- a -}" is a comment, "{-a-}" is a comment, "{--a--}" is a comment, 
"{---}" is a comment. That is done right. Similarly, in C, "/***/" is a 
comment; in C++, "///" is a comment (compare with Haskell's "---"!); in 
LaTeX, "%%@#$&^*" is a comment. These are all done right. Consistently.



More information about the Haskell-Cafe mailing list