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.

.



Relevant Pages

  • Re: Ron Garret considered harmful
    ... | | So, according to you, symbol macros introduce a binding?... ... | According to Pascal and Ron they introduce a lexical binding. ... > (defun foo () foo) ... the "global lexical variables" that CL otherwise lacks. ...
    (comp.lang.lisp)
  • Re: Ron Garret considered harmful [Re: DEFSTRUCT and lexical environment]
    ... [Here Ron plays game of ignoring technical evidence provided because the ... |>> Minimal compilation is the second part to the mechanism of symbol ... |>> The fact is symbol macros are macro-expanded and the expansions are ... |>> NOT have a variable binding. ...
    (comp.lang.lisp)
  • Re: Determining lexically bound variables inside a macro
    ... one user writes code which inadvertently binds a dynamic var defined ... refer to the global-level binding. ... >> I don't want to use dynamic variables because of the debugging ... > Symbol macros are lexically scoped, so this should do what you want. ...
    (comp.lang.lisp)
  • Re: Ron Garret considered harmful
    ... Madhu wrote on Mon, ... So, according to you, symbol macros introduce a binding?... ... he originally suggest that symbol macros introduce a "lexical binding"? ... So who are you arguing against? ...
    (comp.lang.lisp)
  • Re: Ron Garret considered harmful
    ... | So, according to you, symbol macros introduce a binding?... ... According to Pascal and Ron they introduce a lexical binding. ... by MACROEXPAND. ... I'm still objecting, sadly, on the redherring ...
    (comp.lang.lisp)