[Top][All Lists]

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

Re: special form and macro

From: Harald Hanche-Olsen
Subject: Re: special form and macro
Date: Sun, 21 Feb 2010 10:44:19 -0500 (EST)

+ "alin.s" <address@hidden>:

> What difference exists between a macro and a user-defined special form?

I am not sure the emacs developers' list is the appropriate forum for
this kind of question - the lack of answers is a pretty strong
indication that people think it's not - so I'll be brief. If you need
a more detailed answer, may I suggest the newsgroup gnu.emacs.help?

> In emacs the user cannot define special forms, maybe because the macros keep
> the place of special forms?
> A special form should be defined as
> (special (var1 ... varn) (lambda () ... ))
> During application, var1 ... varn should be initialized temporary inside the
> environment with the unevaluated values of the call. (name val1 ... valn).
> But this is exactly the definition of a macro. Is there a difference . Is
> there a computation that one can do and the other not?

The difference is that a macro expands into a form that is then
evaluated, whereas a user-defined special form, as you define it,
would typically have to do its own evaluation. See section 13 (Macros)
in the elisp manual. I think it's safe to say that a macro can do
anything a user-defined special form can, but not vice versa (both
because macro expansion and evaluation of the resulting form can take
place at different times, and because of lexical scoping issues).

- Harald

reply via email to

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