[Top][All Lists]

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

RE: [Emacs-diffs] trunk r117002: Correctly treat progn contents as tople

From: Drew Adams
Subject: RE: [Emacs-diffs] trunk r117002: Correctly treat progn contents as toplevel forms when byte compiling
Date: Tue, 22 Apr 2014 12:59:49 -0700 (PDT)

> >> That said, the CL way is much better. It's conceptually simpler to say
> >> that defmacro at toplevel is well-defined (progn contents being
> >> considered "toplevel") and everything else is undefined than to try to
> >> support this defmacro stuff in *all* contexts and run into the exciting
> >> corner inherent in your approach...
> >
> > Are you saying that in CL if defmacro is used elsewhere than at top level
> > it is not well-defined?  That doesn't sound right to me.
> >
> > (Apologies if I misunderstand.  If so, or if irrelevant, please ignore.)
> Compilers appear to differ. Consider the code below:
> (defun foo ()
>   (defmacro bar () 1)
>   (bar))
> (format t "~s" (foo))
> SBCL and ECL both signal an error. CLISP compiles the file, substituting
> (bar) with 1, then complains when calling foo that bar is redefined.

I see.  But that does not imply that the standard says that the behavior
is undefined for `defmacro' at other than top level.  That's what I
thought you were saying.  Implementations do not always implement what
a standard says. ;-)

> The SBCL and ECL behavior is what I'd expect from reading the spec, but
> maybe I misunderstood something.

Hm.  What part of the spec do you think gives the impression that
`defmacro' behavior is defined only at top level?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]