On Mon, Sep 18, 2006 at 04:29:43PM +0000, Per Bothner wrote:
> One-sentence summary of the issue: #;<datum> comments useless
I'm just an interested bystander, but I have to disagree with your
summary. Now read on:
> Having 3 different comment syntaxes (four, if you count #!)
> is overkill.
They serve different purposes: line, block and expression commenting.
> #;<datum> is always equivalent to #|<datum>|#. It saves two
> characters,
> [...]
> Furthermore, #|<datum>|# is strictly more powerful, since it can
> comment out not just a single <datum> but as many as you want.
;([^\n]*)\n is always equivalent to #|\1|#. It saves two characters.
Block comments are strictly more powerful than line comments, because
one can comment out not just a single line but as many as you want.
By these arguments, both #; and ; should be removed (leaving only
#||#).
> at the cost of making it harder to see where the comment ends.
> [...]
> In "production" code or anything else supposed to be maintainable
> you clearly should use #|...|# instead since it is much safer and
> clearer exactly what is commented out.
That sounds like opinion. If it's objective truth, can you please
prove it?
Now, here are my reasons for preferring expression comments (#;) to
block comments (#||#) when commenting out expressions.
Firstly, when the comment expression is the last subexpression, it
does not break up the trailing parens with the closing lexeme. Of the
following two forms, I consider the former more aesthetically pleasing
than the latter.
(+
(- foo
bar
#;
(this is
a
long
(expression (that
has
many
parens)))))
(+
(- foo
bar
#|
(this is
a
long
(expression (that
has
many
parens)))|#))
Secondly, because #; guarantees to comment out exactly one expression,
I do not need to look for the closing lexeme. In the above example,
it would be quite easy for a student to accidentally write
(+
(- foo
bar
#|
(this is
a
long
(expression (that
has
many
parens))|#)))
producing a syntactic error that is potentially very difficult to
detect (without a smart editor).
Thirdly, it is safe for an editor to assume that the expression
commented out by #; is a symbolic expression, rather than arbitrary
text. This means it can safely provide the same indenting and
structured editing facilities that it provides outside of comments.
For example, if the buffer contains
#;-!- A
then typing ( could usefully insert both opening and closing
parentheses:
#;(-!-) A
And if the buffer contains
#;(foo bar-!- baz)
then typing Return could usefully indent after adding a newline:
#;(foo bar
-!-baz)
In the above examples, -!- indicates the position of the cursor.
--
Trent Buck, Student Errant
Received on Fri Sep 29 2006 - 23:33:42 UTC