[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: dmg@goldilocks.LCS.MIT.EDU
- Subject: Using Make-Symbol
- From: Eric Benson <firstname.lastname@example.org>
- Date: Thu, 7 Mar 91 12:01:37 PST
- Cc: email@example.com
- In-reply-to: dmg@goldilocks.LCS.MIT.EDU's message of Thu, 07 Mar 91 10:23:56 EST <9103071523.AA03466@blaze.LCS.MIT.EDU>
Date: Thu, 07 Mar 91 10:23:56 EST
In reply to firstname.lastname@example.org:
Important point... anyone who's ever tried debugging a
macro-expansion with #:G8494, #:G8495, etc, has encountered
'#: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!