Re: Why no SYMBOL-MACRO-FUNCTION?



On Jul 31, 7:04 am, Pillsy <pillsb...@xxxxxxxxx> wrote:
It's not so hard to find the expansion function associated with an
ordinary macro---you just use MACRO-FUNCTION. Finding information
about the function or value associated with a symbol is similarly
straightforward. There doesn't seem to be as good a way for doing the
same with a symbol: AFAIK the best you can do is check the second
return value of macroexpand.

Interestingly, HyperSpec clearly talks about symbol macros having a
function. Obviously, it's just a trivial function that returns the
specified expansion, so it's not particularly interesting. If there
were a SYMBOL-MACRO-FUNCTION, it wouldn't be that useful unless it was
assignable.

The functionality of a custom function behind a symbol macro can be
obtained by expanding the symbol to compound form that calls an
ordinary macro.

There's also no good way to get rid of a symbol-macro definition for a
symbol; FMAKUNBOUND works for regular macros, but for some reason
MAKUNBOUND doesn't work for symbol macros,

I would regard that as an implementation bug, since the symbol macro
is a kind of binding, and the requirement for MAKUNBOUND is to just
remove the symbol's binding. There is no clause there to exclude
symbol macros. Just my interpretation.

.