[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: "cl-compiler" <email@example.com>
- Subject: issue DEFINING-MACROS-NON-TOP-LEVEL
- From: "AITG::VANROGGEN" <firstname.lastname@example.org>
- Date: 23 May 88 14:06:00 EDT
- Cc: vanroggen
- Reply-to: "AITG::VANROGGEN" <email@example.com>
This one looks pretty good too.
language on p. 66 of CLtL which states that the compiler is not
required to recognize defining macros at other than top-level.
Except this is still true:
(let ((x (f)))
(defmacro m (y) `(+ ,x ,y)))
(defun g (...)
... (m ...) ...)
and inside G the use of M is an error because it isn't guaranteed to be
recognized as a call to a macro. As you indicate later, using EVAL-WHEN
would provide a means of avoiding this problem.
Another example of this restriction:
(defun f (...)
(defstruct ship length ...)
... (ship-length ...) ...
The use of SHIP-LENGTH in F is an error.
It would be worthwhile to remind readers that the names/bindings are
still global. Thus in the defstruct example above,
there is not guaranteed to be a SHIP type until after F is called, there
might not be any SHIP-xxx functions until after F is called, and
all the names created by the DEFSTRUCT will be global.