[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using Make-Symbol

   Date: Thu, 07 Mar 91 10:23:56 EST
   From: dmg@goldilocks.LCS.MIT.EDU

   In reply to mbr@breeze.bellcore.com:

   Important point... anyone who's ever tried debugging a
   macro-expansion with #:G8494, #:G8495, etc, has encountered
   this problem.

   Nit Elaboration:

   '#:foobar   is shorthand for    (make-symbol "FOOBAR")

   I find it looks much nicer:

	   (let ((foo '#:foo))
	     `(let ((,foo ,form))

Note that '#:foobar uses the same symbol every time the macro is
called, while (make-symbol "FOOBAR") creates a new symbol each time it
is called.  Usually there is no problem using the same symbol each
time (as in fact usually there's no problem using an ordinary interned
symbol) but there are cases such as nested invocations of a macro
where using the same uninterned symbol can still cause problems.

I came into this discussion of macros late when someone forwarded me a
message sent to this list commenting on the section in "Lisp Style &
Design" on macros.  Since I wrote that section, I'll be happy to
respond to any questions.  The message I saw didn't really say much,
except that it wasn't "compelling," so I'll wait for specific querys.
Since indiscriminate use of macros is one of my biggest pet peeves,
I'll leave you with some of my favorite quotes on the subject:

Don't use a chainsaw when a butter knife will do.

Was this macro really necessary?

Macros: Just Say No!