[Top][All Lists]

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

Re: macros, procedure->macro

From: Marius Vollmer
Subject: Re: macros, procedure->macro
Date: 14 Jul 2002 18:26:12 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Neil Jerram <address@hidden> writes:

> Thanks for pointing this out.  However, r5rs are by definition
> hygienic, one of the corollaries of which (if I understand correctly)
> is that it makes no difference when or how many times macros are
> expanded.

It does make a difference when we also consider redefinitions, and
definitions textually after the first use.  I.e., which definition of
bar is used in the following example?

    (define-syntax bar ...)
    (define (foo) (bar))
    (define-syntax bar ...)

> With r5rs macros, therefore, we can easily delay expansion as late as
> possible (e.g. immediately before evaluation) so as to support all
> kinds of recursive references.

I think it is more important to give us leeway to perform macro
expansion as early as possible, to make life easy for compilers.

> With non-hygienic macros, timing matters.  So, if Guile wants to
> support non-hygienic macros at all (in addition to r5rs), it's
> important to be precise about when they are expanded.

Another option would be to not be precise and just expect macro
writers to code their macros in such a way that they don't depend on a
the exact behavior of the implementation.  This might even be
desirable, to encourage people to write portable code.

The conservative assumption is that macros are expanded once, in a
environment that is totally different from the run-time environment.

But, of course, precisely specifying our implementation works is also
a good thing.

reply via email to

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