[Top][All Lists]

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

Re: [Chicken-users] hart and syntax-case won't play nice. :(

From: John Cowan
Subject: Re: [Chicken-users] hart and syntax-case won't play nice. :(
Date: Sat, 15 Mar 2008 15:21:41 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Robin Lee Powell scripsit:

> Are you saying that all things that use low-level macros die when you
> load syntax-case?  So if I want to use high-level macros with hart,
> I'm just screwed?

Essentially yes.  Native Chicken and Chicken-with-a-syntax-expander
are two different and incompatible dialects: the first supports only
low-level macros defined with define-macro, whereas the second supports
only high-level macros defined with define-syntax.  Exactly what is
allowed to go in a define-syntax depends on the particular expander you
use (currently we have syntax-case, syntactic-closures, alexpander, and
riaxpander), except that all of them support syntax-rules as required
by R5RS.

Chicken starts out in its native dialect, and then switches to an expander
dialect as soon as you load an expander with use or require-extension
(same thing, by the way).  After that, any macros that had been defined
by define-macro are hidden and inaccessible.  Yes, this sucks; it's
a consequence of the way syntax-expanders work -- they preprocess all
incoming code and remove all macro definitions and uses.

The good news is that because syntax-expanders run at compile time, you
can mix and match modules that are separately compiled with different
expanders.  However, a module that *exports* macros has to be available
in source form at compile time (or at least the macros do), so the
conflict arises again.  Hart, in particular, contains *only* macros,
so it is never compiled into object code.

> What about define-syntax, rather than syntax-case?  That's the only
> thing I'm importing syntax-case for anyways.  (Yes, I'm friends with
> John Cowan :)

You mean syntax-rules, not define-syntax; define-syntax is the
universal wrapper for every type of high-level syntax definition, not
just syntax-rules.  As noted above, syntax-rules is provided only by an
expander, so it's incompatible with low-level macros.

> I really have *no* interest in learning low-level macros.

Life sucks and then you die (probably).

John Cowan                                address@hidden
I amar prestar aen, han mathon ne nen,
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, LOTR:FOTR

reply via email to

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