[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: issue DEFINING-MACROS-NON-TOP-LEVEL, version 8
- To: Sandra J Loosemore <email@example.com>
- Subject: Re: issue DEFINING-MACROS-NON-TOP-LEVEL, version 8
- From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Thu, 16 Mar 89 14:52 EST
- Cc: firstname.lastname@example.org
- In-reply-to: <8903142211.AA03724@defun.utah.edu>
This message is just about the issue of the order of non-top-level
subforms of a top-level form.
Date: Tue, 14 Mar 89 15:11:20 MST
From: email@example.com (Sandra J Loosemore)
> Date: Tue, 14 Mar 89 15:58 EST
> From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
> The order in which
> non-top-level subforms of a top-level form are processed by the
> compiler is explicitly left unspecified.
> I can't figure out what this means and the example in the rationale
> section that purports to explain this does not shed any light, since in
> the example there is no change of order of evaluation.
I don't know how to explain this any more clearly -- what's in the
current version of the proposal is about the third attempt I've made.
Well, here goes a fourth attempt.
Suppose I have a top-level DEFMACRO at the top of the file. Item (3)
guarantees that this DEFMACRO will be processed before any top-level
forms that appear textually after it. That means I can refer to the
DEFMACRO in those subsequent forms and guarantee that the compiler has
already "seen" the macro definition. The same rule applies to any
other defining macros that do compile-time magic at top-level.
Now suppose expanding this macro has some side-effects, such as
SETQ'ing a special variable. If I have two calls to the macro at
top-level, I can reliably depend on the side-effects happening in the
same order that the calls appear textually. But, the other thing that
item (3) says is that if the two macro calls are embedded at
non-top-level, I can't rely on the order in which the compiler will
This explanation is much clearer. Nothing in the explanation that I
couldn't figure out indicated that it had anything to do with macro
expansion; that was the missing information. Could you amend the
proposal to clarify this? Also I found the phrase "non-top-level
subforms of a top-level form" confusing; I wonder if it would work
better to say that the order of expansion of macros is unspecified
for all forms other than top-level forms, i.e. list the cases where
the order is specified and don't try to list the cases where the
order is not specified.
I agree this could be made into a separate issue and be expanded to
include a statement that processing of top-level forms is interleaved
with reading. It had more to do with this issue when the definition
of top-level appeared here.
I still think point (3) should be moved to be together with the rest
of the definition of top-level.