"Ludovic Courtès" wrote:
>  (define-syntax +
>    (let ((plus +))

I am assuming you are starting the program with:

(import (rnrs))

or you are importing at level 1 a library which exports "+";
if this is  the case, and you want  R6RS compatibility, IMHO
this should fail because  you are redefining the binding for
"+";  many R6RS  implementations agree  with this  (with the
exception of Ypsilon which has hygiene problems and must not
be taken as model).

  Notice that  bindings from  "(rnrs)" are imported  at both
levels 0 and 1[1]:

    For  the libraries  defined in  the library  report, the
    export  level   is  0  for  nearly   all  bindings.  The
    exceptions are syntax-rules, identifier-syntax, ..., and
    _ from  the (rnrs base (6)) library,  which are exported
    with  level 1, set!  from the  (rnrs base  (6)) library,
    which is exported with levels  0 and 1, and all bindings
    from  the  composite  (rnrs  (6)) library  (see  library
    chapter on “Composite library”), which are exported with
    levels 0 and 1.

  As  a side  note: the  existence  of the  binding for  the
keyword can be recorded by  SYNTAX in the right-hand side of
a DEFINE-SYNTAX, so  that the binding itself is  can be used
to refer to the context of the definition:

  (import (rnrs))

  (define ciao 123)

  (define-syntax this
    (lambda (stx)
      (syntax-case stx ()
        ((_)
         (datum->syntax #'this 'ciao)))))

  (write (this))
  (newline)

and also:

  (import (rnrs))

  (define ciao 123)

  (define-syntax this
    (let ((ctx #'this))
      (lambda (stx)
        (syntax-case stx ()
          ((_)
           (datum->syntax ctx 'ciao))))))

  (write (this))
  (newline)

for this kind  of things, I suggest taking  the behaviour of
Larceny as model: if it works with it, it will probably work
with all the other R6RS implementations.

HTH

[1] <http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-10.html#node_sec_7.2>
-- 
Marco Maggi

Reply via email to