[Haskell-cafe] Comment Syntax

Richard O'Keefe ok at cs.otago.ac.nz
Wed Jun 8 03:42:10 CEST 2011


On 7/06/2011, at 9:36 PM, Guy wrote:
> 
> Out of interest, is there any other language where the comment delimiter is invalid if immediately followed by a symbol?

Not exactly what you asked, but in some implementations of Algol,
	comment This is a comment;
	commentThis is a syntax error;
And in the documentation of the M4 macro processor,
where changecom(L,R) sets left and right delimiters for comments
and changequote(L,R) sets left and right delimiters for quoting,
the effect of having one of these left delimiters a prefix of the
other is undefined.  When it happens by accident the results are,
well, confusing.  But after doing
	changecom(dnlx)
you find that
	dnl xyz
is a call to the built in macro "Discard until New Line", while
	dnlx yz
is a comment.

There have been Prolog systems on IBM machines where the set of
legal tokens depended on which operators had been declared.
For example, if you had declared -- as an operator, then
---- was two -- tokens, but otherwise four - tokens.  What they
did with comments I shudder to think.




More information about the Haskell-Cafe mailing list