chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] define-macro in Chicken 4.0


From: felix winkelmann
Subject: Re: [Chicken-users] define-macro in Chicken 4.0
Date: Sat, 14 Mar 2009 10:08:43 +0100

On Fri, Mar 13, 2009 at 8:48 PM, Eduardo Cavazos <address@hidden> wrote:
> Hello,
>
> Is there a way to define 'define-macro' in terms of the new explicit
> renaming macros of Chicken 4.0? Or is it offered somewhere and I just missed
> it?
>
> I know I know... 'define-macro' is bad. :-) But I have a bunch of code that
> I'd like to have "just work" in Chicken 4.0 and worry about porting the
> macros over later.

It is possible to do that, but it will not work. The problem is that identifiers
have to be renamed, depending on the syntactic environment they are
used in (that's what all the hygiene is about). Macros introduce "alias"
identifiers to prevent name-capture and if you write a macro which
expands into the use of an identifier which was previously inserted by
another macro expansion, you have to resolve the identifier properly
to find the correct meaning. That is what the "rename" procedure in
explicit renaming macros does. So macro-introduced identifiers will
not be properly handled in your define-macro-style macros.

The only way is to translate them to explicit-renaming, which is easier
than it sounds, or use syntax-rules for the simple ones.


cheers,
felix




reply via email to

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