[pro] #; comments...

Robert Smith quad at symbo1ics.com
Sun May 6 19:07:34 UTC 2012


Hello,

You say #+nil is not reliable, which I agree with. However, what I'm
in the habit of using is #+#:ignore, which AFAIK should be always
reliable: #:ignore won't and can't be interned.

Even if #:ignore is in your features, it won't help.

CL-USER> (push '#:ignore *features*)
(#:IGNORE ...)
CL-USER> (+ 1 #+#:ignore 2 3)
4

I do use this in practice, and I also use it as a form of
documentation on why I'm commenting something out. As a sort of
contrived example:

(defun f ()
  #+#:ignore-buggy
  (progn ...)     ; buggy code

  (progn ...))    ; working code

Though, this is certainly clunkier than a dedicated #; macro.

Cheers!

Robert Smith
quad at symbo1ics.com

On Sun, May 6, 2012 at 1:57 PM, Pascal Costanza <pc at p-cos.net> wrote:
> Hi,
>
> I'm thinking about writing up a CDR on #;-style comments. Currently, if you want to comment out a form from CL code, there is no standard way of doing this. Many people use something like #+nil, or similar tricks, but this is not 100% reliable. R6RS Scheme introduced #; as a solution, and this seems to become somewhat popular in CL as well.
>
> Here is a suggested wording.
>
> ------------- snip -----------------
>
> #; is used to comment out single expressions; the syntax is /#; expression/. This textual notation is treated as whitespace; that is, it is as if the ``#; expression'' did not appear and only a space appeared in its place.
>
> #; operates by skipping over the form. Skipping over the form is accomplished by binding *read-suppress* to true and then calling read.
>
> ------------- snip -----------------
>
> The text is based on 2.4.8.17 of the HyperSpec. Yes, this would be a fairly short CDR document.
>
> Any comments or ideas about this?
>
>
> Best,
> Pascal
>
> --
> Pascal Costanza
>
>
>
>
> _______________________________________________
> pro mailing list
> pro at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro




More information about the pro mailing list