Eli Barzilay wrote:
> (And the point is that #; is an s-expr operation, and if I
> don't know where my sexprs end, then chances are my code is bad
> anyway.)
And since you also agree that #; comeents are mainly used during
debugging when you know or suspect your code is bad anyway, then
you've essentially conceded my point ...
> On Sep 29, Per Bothner wrote:
>>> [...]
>>>     (+
>>>      (- foo
>>>         bar
>>>         #|
>>>         (this is
>>>               a
>>>               long
>>>               (expression (that
>>>                            has
>>>                            many
>>>                            parens)))|#))
>> Aa I said above: you really don't want this in production code, or
>> more generally anything that is 'checked in" (to a source-code
>> repository).
> 
> Huh???  Are you seriously suggesting that repositories should contain
> no commented code?
I assume you meant to write "commented-out code".  And, yes, there is
little or no justification for commented-out code in repositories
*unless* it is accompanied by a non-s-expr comment explaining why
it is commented-out.
> Here's something that didn't come up in this thread, and that I use a
> lot: the nice thing about having line-, block-, and sexpr-level
> comments is that they can compose in useful ways.  You said that you'd
> always want to add a comment about why the code is disabled, which I
> always do like this:
> 
>    #; ; this code is ...
>    (...)
This works as long as the comment fits on a line.  So now you have a
coding style that strongly encourages terse comments.
I guess you could do:
    #; the code is commented out
    ;; because the function foo is broken
    ( .(foo ..).)
    ;; instead we have to sue to slower bar:
    ( (bar ...))
The problem is it is easier to lose track what is commented out (and
why) than with plain old-fashioned block comments, which are much more
visibly obvious where they begin and end.
> And because the whole comment openning is on one line, it can be
> `toggled' with a single semicolon:
> 
>   #; ; version A
>   (...A...)
>   ;#; ; version B
>   (...B...)
>   #; ; version C
>   (...C...)
> 
> (And yes, this is mostly useful for debugging.)
This argues for a conditional-compilation/reader mechanism, like
Common Lisps #+ and #-.
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Sat Sep 30 2006 - 13:23:02 UTC