Comment Syntax
Thomas Davie
tatd2 at kent.ac.uk
Mon Jan 30 07:17:44 EST 2006
I would like to suggest a different change to single line comment
syntax to do two things. First, address an inconsistency with multi
line comments, and secondly remove one of the main sources of
confusion for beginners.
My proposal is to make any text beginning '--' a comment (rather than
requiring a space after the two dashes. I appreciate that the
argument against this is that various operators that look like this
are useful (e.g. -->). However I think that any benefit gained by
operators like this is lost in confusion.
In order to back up my suggestion, I'd like to point out, that this
is indeed already how it is done for block comments. i.e. we do not
expect {-> to be an operator, we expect it to be the beginning of a
comment.
Secondly, from my limited experience helping to teach Haskell, the
comment syntax is a primary source of confusion for beginners.
Beginners inevitably forget (or don't know) to add the space, and
will receive confusing errors about undefined symbols, or type
mismatches. This is made yet more confusing by the fact that the
compiler appears to be pointing at an error in a comment.
Thanks
Tom Davie
More information about the Haskell-prime
mailing list