[Top][All Lists]

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

Re: macros, procedure->macro

From: Neil Jerram
Subject: Re: macros, procedure->macro
Date: 14 Jul 2002 16:23:09 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Clinton" == Clinton Ebadi <address@hidden> writes:

    Clinton> On Friday 12 July 2002 20:09, Neil Jerram wrote:
    >> Thanks, that's helpful.  So we won't support references to a macro
    >> that is defined in a following top-level form, as in:
    >> (define-macro (foo x) `(list ,(bar x) ,x))
    >> (define-macro (bar x) `(* ,x ,x))
    >> or is there a cunning plan that still allows us to support this?

    Clinton> Just use r5rs macros:
    Clinton> (use-modules (ice-9 syncase))
    Clinton> (define-syntax foo (syntax-rules () ((foo x) (list (bar x) x))))
    Clinton> (define-syntax bar (syntax-rules () ((bar x) (* x x))))

    guile> (foo 5)
    Clinton> (25 5)

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

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.

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.


reply via email to

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