chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: Explicit Renaming Macros Help/Tutorial?


From: Jim Ursetto
Subject: Re: [Chicken-users] Re: Explicit Renaming Macros Help/Tutorial?
Date: Thu, 11 Jun 2009 18:24:41 -0500

On Thu, Jun 11, 2009 at 5:17 PM, Jack Trades<address@hidden> wrote:
>> It is uncommon to test against the macro's name, but we can
>> do it by using the compare procedure against the renamed 'ef
>> identifier.
>
> So the purpose of the compare procedure is to compare renamed identifiers?

Note that we only renamed one of the identifiers--the car of the form.
compare checks that the identifiers denote the same thing in the macro
usage environment.  The rename instead causes us to use the denotation
in the macro definition environment for that identifier.  In other words
(compare (car args) (rename 'ef)), where args is (t-ef ...), compares
the identifier 't-ef at the point where the macro is expanded
(i.e. in your module) with the identifier 'ef at the point where you
defined the macro (when it was named ef).  Since you
have done an import that renamed ef -> t-ef at the point where you
invoked the macro, 't-ef in that usage environment matches the
"real" name of the macro where it was defined: ef.

This is all explained in
http://chicken.wiki.br/man/4/Modules%20and%20macros#Explicit%20renaming%20macros,
though
admittedly it is dense, and the other links people
gave are helpful as well.  The wiki entry is basically ripped straight from
the original ER paper, so it's pretty much the canonical documentation.
The various flavors of macros seem to be the least well-documented
aspect of Scheme.

>> Here is the modified code.
>>  (er-macro-transformer  ...

> I get an "unbound variable: er-macro-transformer" error when I include this
> line.

Sorry.  er-macro-transformer was added in SVN r14236 (Chicken 4.0.1) and
I suspect you are using the release version, 4.0.0.  You can just omit it
without changing the meaning.  You don't have to import chicken, it is
actually exported from the scheme module.

Jim




reply via email to

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