[gambit-list] Bug involving syntax-rules and c-lambda

Marc Feeley feeley at iro.umontreal.ca
Wed Feb 4 07:45:09 EST 2009


On 2-Feb-09, at 6:57 AM, David Rush wrote:

> Hi there,
>
> I decided that it would be good to make sure that I am up-to-date  
> with Gambit 4.4 before I posted my web framework here for those who  
> have expressed an interest and I am finding a destructive  
> interaction when using the c-lambda form.
>
> With the code in the sequel and Gambit 4.4.0, if I compile thusly:
>
> $ gsc -:s -link bug.gambit
> *** ERROR IN MAP -- invalid syntax ()
>
> but it compiles fine if I omit the -:s option. Now obviously, the  
> example does not require syntax-rules macros, but the full framework  
> certainly does. Is there a known incompatibility here? The text  
> concerning define-syntax hints at such a possibility, but the actual  
> interaction is unclear.


If you look at the manual under "define-syntax" you will see:

   Note that this implementation of syntax-case does not support  
special forms that are specific to Gambit.

And c-lambda is one of those Gambit specific forms.  The Hieb and  
Dybvig portable syntax-case implementation which is used by Gambit  
does not know that c-lambda is a special form, so when it sees (c- 
lambda () ...) it thinks this is a function call and () is an  
expression, which is illegal in Scheme (you need to quote the () if it  
was an expression).  That's why you get an error message.  Note that  
it is the portable syntax-case implementation that is detecting this  
error.

I'll see what I can do to extend the portable syntax-case  
implementation for Gambit.  Last time I tried I remember a problem in  
the bootstrap process.

Note that for your specific need for this code, I'm curious why you  
need to interface to the C timeval structure.  Can't you implement  
timing using (current-time) and (timeout->time timeout)?

Marc




More information about the Gambit-list mailing list