On Sep 29, Per Bothner wrote:
>
> Of course it's my opinion, informed by taste and experience. But it
> seems fairly clear that you can accidentally comment out the wrong
> thing more easily with #:... than with #|...|# and (more important)
> the compiler won't help you find your mistake. If you misplace the
> |# the the reader will complain. With #; you have to know where the
> s-expr ends, and if you're wrong it is still a valid s-expr.
How about an alternative to #; when used for side-effects -- put the
expression in a function. This provides a similar facility and shows
why the above reply is nonsensical: the compiler won't tell me when
I'm wrong. (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.)
> > [...]
> > (+
> > (- 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? Or that somehow only
(- foo
bar
;; (this is
;; a
;; ...)
)
is kosher for your repository?
> What is the purpose? If you want to comment out a fragment of
> production code you need to explain *why* it is commented out, using
> *text* - and so it's no longer an s-expr.
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 ...
(...)
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.)
On Sep 30, Abdulaziz Ghuloum wrote:
> I personally feel very strongly against writing poorly-indented
> code.
Which is BTW another reason I dislike #||# for commenting sexprs: I
dislike going to the other end, and I'll never put it there when there
is code following (even if it's ")))").
> I cannot stand reading poorly-indented code; especially in
> production code. I also feel that tabs are evil.
(Don't forget spaces at end-of-lines.)
> Should I submit a formal comment about it? Do style and coding
> conventions belong to any language standard? (I don't think so.)
(Python?)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!
Received on Sat Sep 30 2006 - 13:01:15 UTC