chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] importing a syntactic binding for level -1


From: Peter Bex
Subject: Re: [Chicken-users] importing a syntactic binding for level -1
Date: Sat, 13 Jul 2019 09:01:49 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

On Sat, Jul 13, 2019 at 08:26:56AM +0200, Marco Maggi wrote:
>   I would like to write such macro as:
> 
> (import (scheme)
>         (chicken fixnum))
> (import-for-syntax (scheme)
>                    (only (chicken syntax)
>                          er-macro-transformer)
>                    (only (my-lib)
>                          doit))
> 
> (define-syntax spiffy
>   (er-macro-transformer
>     (lambda (input-form.stx rename compare)
>       (define %fx+ (doit rename))
>       ---)))
> 
> and in the library "(my-lib)" I have:
> 
> (define (doit rename)
>   (rename 'fx+))
> 
> but for  this to work  cleanly: in "(my-lib)"  I should import  "fx+" at
> level -1?  Is it right?

Hi Marco,

This won't work.  "rename" is operating in the syntactic environment
of the transformer.  You can pass it as a procedure to some other module,
but that won't change its internal state.

>   This is possible with R6RS implementations.  How about CHICKEN?

That is very surprising to me.  It should not be possible.  You're
probably comparing apples and oranges (syntax-case works differently
from ER macros).

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature


reply via email to

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