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

symbol-macrolet



I suppose we should say explicitly that the symbol macros are recorded
in the macroexpansion environment so that macroexpand-1 of a symbol
which is a symbol-macro will expand it.

In the text in my draft, this would correspond to including something
like the following in remarks.

Within the body of symbol-macrolet the macroexpansion environment is
augmented to include a symbol-macro definition for the symbol.  When
given the symbol and the environment as arguments, macroexpand-1 will
return the expansion.  This means that a macro which appears in the
scope of symbol-macrolet can use macroexpand-1 to determine whether or
not a symbol names a symbol macro; this is particularly useful for
macros which want to determine whether or not their argument is a
symbol. 

Examples:

(defmacro ^2 (form &optional environment)
  (if (and (symbolp form)
           (eq (macroexpand-1 form) environment))
      `(* ,form ,form)
      `(expt ,form 2)))

This is a pretty lame example.  Hopefully we can come up with something
else that is as simple but more compelling.

Also, we may want to mention explicitly the zetalisp macro once-only.
-------