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: Eduardo Cavazos
Subject: Re: [Chicken-users] define-macro in Chicken 4.0
Date: Sat, 14 Mar 2009 04:27:11 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080716 SeaMonkey/1.1.11

On Fri, Mar 13, 2009 at 8:48 PM, Eduardo Cavazos <address@hidden> wrote:

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.

felix winkelmann wrote:

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.

Well, I have some "portable" Scheme code; i.e. code that runs on a few implementations. In that code are some macros which intentionally break hygiene. So that rules out syntax-rules. Just about everybody supports define-macro so it was easy to achieve portability that way. Explicit-renaming macros don't seem to be as widely supported. For example, I don't think they're in Ypsilon or Ikarus. Didn't Clinger invent ER macros? They better damn well be in Larceny. ;-)

So... will syntax-case be offered as an egg?

syntax-case is much more widely supported (yeah I know, it's icky) and it allows responible bending of hygiene.

Ed




reply via email to

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