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

eval'd macros

    Date: Mon, 3 Feb 1986  20:36 EST
    From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>

	(defun fn () (mac))            ;==> FN
	(defmacro mac () `'foo)        ;==> MAC
	(fn)                           ;==> ***Error***

    You don't say whether the problem you described occurs in the
    interpreter or the compiler.  Your example certainly is not required to
    work when compiled because the macro definition follows the use.  In my
    opinion, this should work without an error in the interpreter.  Hacking
    in the interpreter would be fairly awkward if it didn't.  However, the
    fourth paragraph on page 143 seems to give implementors permission to do
    compiler-like macro expansion when a defun is first seen.  I wouldn't
    want to use such an implementation, but it probably is legal as the
    manual currently stands.

It should probably still work if compile-like macro expansion is done at
definition time.  If the system goes further and actually DOES compile
the defun, then I would consider it a user-interface bug that the
compiler doesn't tell the user that it couldn't find a function call

(defun fn () (mac))
(compile 'fn)
The following functions were referenced but don't seem defined:
 MAC referenced by FN