Quick Quiz?
What language has comments with side effects? In essence, comments which are not comments...
Quick Quiz?
What language has comments with side effects? In essence, comments which are not comments...
CSS for clever cross-browser hacks. Of course, I wouldn't really call CSS a language.
Haskell can turn the usual comments in code paradigm upside down by having code in comments - also Mathematica and the like; literal programming is a nice feature for the more mathematically inclined languages.
I also find annotations in Java are like comments with behaviour.
DOS Batch Shell programming
The REM (Remark) allows you to put in a comment. But it has the side-effect of modifying the ERRORLEVEL variable to 0.
In a sense, it makes last operation a success.
I don't know how a comment can fail, but if it does, you are covered.
I can think of several places where comments aren't really comments.
And then, considerably more obscurely:
--#
' was used by D4GL to include material only applicable to D4GL; I4GL would see that as a comment. The inverse notation was '--@
', which looked like a comment to D4GL but was treated as active material by I4GL.And, even more obscurely:
#
' (hash) marked the start of a comment outside of strings - up to the next newline, as does '--
' (double-dash). Also, '{...}
' (braces) enclose multiline comments.{...}
' which is, of course, perfectly legitimate in shell. The shell script was a data-driven code generator that copied itself to the top of the output, and then generated about 100 functions which were all depressingly similar but slightly different (in a language without templates or a pre-processor). The code had to validate what was in the database for a given ship against incoming data from an external source (Lloyds of London, in fact), to see what had changed since the last time the external data was received. Non-trivial comparison work, especially since it had to deal with database (SQL) nulls.Then of course there are "polyglots" -- programs which can be compiled/executed in multiple languages. Usually these rely on the fact that the same line is a comment in one language, but an actual line of code in another.
QBasic has a use of comments all its own: REM $STATIC
or REM $DYNAMIC
set how arrays are allocated.
Another example: When web browsers parse comments <!-- -- -->in<!-- -- -->correctly
.