From: Jim Cheng
Subject: Lisp Syntax #|  ???
Date: 
Message-ID: <3988AB66.F3793F32@yahoo.com>
Hi,
     I am a new comer to lisp.
Is #| ... #1 used for annotation in  Lisp?

for example, the contents between #| and #| are just annotations ?

#|(defstruct node
  (x0)  ;; after rotation
  (y0)
  (x1)
  (y1)
  (line)
  ) #|

 Thanks!

Jim

From: Barry Margolin
Subject: Re: Lisp Syntax #|  ???
Date: 
Message-ID: <Hh2i5.67$PL5.3917@burlma1-snr2>
In article <·················@yahoo.com>, Jim Cheng  <·······@yahoo.com> wrote:
>Is #| ... #1 used for annotation in  Lisp?
>
>for example, the contents between #| and #| are just annotations ?

Yes.  The term most computer programmers use (at least in the US) is
"comments".

However, the end is marked with |#, not #|.  This is similar to many other
languages that have paired-up comment markers, e.g. /* ... */ in PL/I and
C.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Christophe Rhodes
Subject: Re: Lisp Syntax #|  ???
Date: 
Message-ID: <sqog3bcj0b.fsf@lambda.jesus.cam.ac.uk>
Barry Margolin <······@genuity.net> writes:

> In article <·················@yahoo.com>, Jim Cheng  <·······@yahoo.com> wrote:
> >Is #| ... #1 used for annotation in  Lisp?
> >
> >for example, the contents between #| and #| are just annotations ?
> 
> Yes.  The term most computer programmers use (at least in the US) is
> "comments".
> 
> However, the end is marked with |#, not #|.  This is similar to many
> other languages that have paired-up comment markers, e.g. /* ... */
> in PL/I and C.

Although the lisp ones (#| ... |#) have the advantage that they nest
properly -- cf. /* /* ... */ */, which is a great advantage when
commenting out large chunks of code -- you don't need to worry about
whether you've got embedded comments.

Christophe
From: Robert Monfera
Subject: Re: Lisp Syntax #|  ???
Date: 
Message-ID: <398961AF.38E2C091@fisec.com>
Jim Cheng wrote:

> for example, the contents between #| and #| are just annotations ?

This is how to remember #| ... |# : 

 # is the strong wall structure that stops the heap of comments from 
      breaking out of its barriers
 | is the inner waterproofing

Robert
From: Martin Cracauer
Subject: Re: Lisp Syntax #| ???
Date: 
Message-ID: <8mp7pp$1fvi$1@counter.bik-gmbh.de>
Jim Cheng <·······@yahoo.com> writes:

>Hi,
>     I am a new comer to lisp.
>Is #| ... #1 used for annotation in  Lisp?

>for example, the contents between #| and #| are just annotations ?

The real comments in Lisp are to-end-of-liners with ';'

#|...|# is an example of a reader macro in action, using it to
implement multiline comments.

>#|(defstruct node
>  (x0)  ;; after rotation
>  (y0)
>  (x1)
>  (y1)
>  (line)
>  ) #|

Temporarily disabling code like this is usually done with a different
reader macro instead:

#+nil
(defstruct 
 ...
  (line))

This is usually preferrable to #|...|# since the editor's indentiation
support still knows how to format the disabled code.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <········@bik-gmbh.de> http://www.bik-gmbh.de/~cracauer/
FreeBSD - where you want to go. Today. http://www.freebsd.org/
From: Erik Naggum
Subject: Re: Lisp Syntax #| ???
Date: 
Message-ID: <3174810853939672@naggum.net>
* Martin Cracauer
| The real comments in Lisp are to-end-of-liners with ';'
| 
| #|...|# is an example of a reader macro in action, using it to
| implement multiline comments.

  You may be surprised, but ; is just a reader macro, too.  I fail to
  see how you can support "real" in any way.  What's unreal about #||#?

| Temporarily disabling code like this is usually done with a
| different reader macro instead:

  Some prefer it this way, but I haven't found any statistics that
  support the "usually".  Where did you find yours?

| This is usually preferrable to #|...|# since the editor's
| indentiation support still knows how to format the disabled code.

  See above for "usually".  _Your_ preferences are noted, but some
  indentation support packages will indent commented code correctly,
  in the understanding that you don't comment out text with #| ... |#.
  For those cases, use several ;'s at the beginning of the line.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.
From: Kent M Pitman
Subject: Re: Lisp Syntax #| ???
Date: 
Message-ID: <sfwn1imxxnj.fsf@world.std.com>
Erik Naggum <····@naggum.net> writes:

> * Martin Cracauer
> | The real comments in Lisp are to-end-of-liners with ';'
> | 
> | #|...|# is an example of a reader macro in action, using it to
> | implement multiline comments.
> 
>   You may be surprised, but ; is just a reader macro, too.  I fail to
>   see how you can support "real" in any way.  What's unreal about #||#?

I didn't see the original context, but maybe this was partly about the use
of comments to annotate code vs to turn off code.  I bet the statistical
norm is to use ";" more for the former and "#|...|#" more for the latter,
though I have no data.  Personally, I use ";" for annotation and 
"#||...||#" for commenting out code, mostly because double vertical bars
makes Emacs motion commands happier.

> | Temporarily disabling code like this is usually done with a
> | different reader macro instead:
> 
>   Some prefer it this way, but I haven't found any statistics that
>   support the "usually".  Where did you find yours?

We could take an informal poll here.  I certainly never use #|...|# for 
running comments, nor does anyone whose code I've ever read other than
in the occasional isolated situation where they are trying to quickly
annex a .text file until they've had time to process it.
 
And, of course, the ANSI spec contains non-normative advice that encourages
at least the semicolon comment behavior.  The advice about #|...|# is less
direct, but does note the option to nest such comments, hence at least a
possible bias in usage toward using this for code.  (Though one could always
use the feature to nest textual comments instead. ;-)

> | This is usually preferrable to #|...|# since the editor's
> | indentiation support still knows how to format the disabled code.
> 
>   See above for "usually".  _Your_ preferences are noted, but some
>   indentation support packages will indent commented code correctly,
>   in the understanding that you don't comment out text with #| ... |#.
>   For those cases, use several ;'s at the beginning of the line.

I find that in general the editor has poor support for formatting #|...|#
owing to numerous editors thinking that # is just an adornment and |...|
is a "stringer" (i.e., syntax like |foo| or "foo")  that cannot be nested.
That's why I use #||...||#, so that it will think there are two "stringers", 
each ||, and that the code between is not "strung".
From: Robert Monfera
Subject: Re: Lisp Syntax #| ???
Date: 
Message-ID: <398A33D4.FF1B5815@fisec.com>
Kent M Pitman wrote:

> We could take an informal poll here.  I certainly never use #|...|# for
> running comments, nor does anyone whose code I've ever read other than
> in the occasional isolated situation where they are trying to quickly
> annex a .text file until they've had time to process it.

Sometimes it's useful to embed short, tokenized comment this way:

(defmethod foo ((x bar) (y baz))
   ...)

(defmethod foo #|speed|# ((x specialized-bar) (y baz))
   {faster, specialized functions while logic is the same})

(defmethod foo :around #|validation|# (x y)
   (assert ...)
   ...)

(defmethod zot #|interface|# (x &optional y)
   (foo x y))

(OK, these should eventually be GF and method attributes implemented
with MOP)

Robert
From: Martin Cracauer
Subject: Re: Lisp Syntax #| ???
Date: 
Message-ID: <8mtmfq$ks9$1@counter.bik-gmbh.de>
Erik Naggum <····@naggum.net> writes:

>* Martin Cracauer
>| The real comments in Lisp are to-end-of-liners with ';'
>| 
>| #|...|# is an example of a reader macro in action, using it to
>| implement multiline comments.

>  You may be surprised, but ; is just a reader macro, too.  I fail to
>  see how you can support "real" in any way.  What's unreal about #||#?

We're arguing words here, my intention was to point out that Common
Lisp as a language is powerful enough to even implement multiline
comments, without cluttering up the lowest level of syntax.

>| Temporarily disabling code like this is usually done with a
>| different reader macro instead:

>  Some prefer it this way, but I haven't found any statistics that
>  support the "usually".  Where did you find yours?

No idea.  I don't comment my code and don't need comments to
understand other people's code :-)

Seriously, I could review the sources I read in the past, but I think
it's better to agree with you that this is my preference and not
neccecarily everybody else'.

>| This is usually preferrable to #|...|# since the editor's
>| indentiation support still knows how to format the disabled code.

>  See above for "usually".  _Your_ preferences are noted, but some
>  indentation support packages will indent commented code correctly,
>  in the understanding that you don't comment out text with #| ... |#.
>  For those cases, use several ;'s at the beginning of the line.

Sure.  The problem here is that the editor's indentation may only
support you when you decide to use #|...|# either for disabling code
*or* for free-text comments, but not both (of course, you may stiil
use the other one after committing to one, but then you'll have to
indent on your own).

Since there is a seperate item #-... that I can use for code, I
reserve #|...|# for text.

The whole thing is a little nitpicky.  ;;;... looks much nicer for
text comments, so I usually just use that.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <········@bik-gmbh.de> http://www.bik-gmbh.de/~cracauer/
FreeBSD - where you want to go. Today. http://www.freebsd.org/