[Maxima-commits] CVS: maxima/src gamma.lisp,1.44,1.45



Stavros Macrakis <macrakis at alum.mit.edu> wrote:
   
   OK, define-compiler-macro was new to me -- I guess it is never used at
   runtime.  Is that really true?  Does it mean that you can't debug
   define-compiler-macro macros when running interpretively?  That seems
   problematic.

A single symbol name can carry both a compiler macro definition and a
regular function or macro.  The usual sane practice is to define a the
compiler macro to have the same behavior as the function or macro,
although this is not required.

There is not requirement in the ANS that the implementation's compiler
expand and use a compiler macro, although generally they do.  You'll
need to check each implementation to see if there are dependencies on
the several optimize declaration qualities.  (A compiler macro may _not_
be expanded by the compiler is the function or macro is locally declared
notinline.)  You cannot otherwise ever depend on a compiled macro not
being used, since implementations are permitted to accomplish
`interpreted' execution, aka eval, as:

  (defun eval (form) (funcall (compile nil `(lambda () ,form))))

Compiler macros can be are extremely important for runtime efficiency,
allowing small code snippets to be inlined, while allowing the
first-class function to exist, for instance, so it can be passed as a
:key or :test function argument to one of the sequence functions.