[Larceny-users] [long] identifier bindings and visibility across phases

Andre van Tonder andre at het.brown.edu
Wed Oct 7 10:04:30 EDT 2009


On Wed, 7 Oct 2009, Marco Maggi wrote:

> Last note before giving  up; the following works for Ikarus,
> Larceny, Mosh and Ypsilon:
>
> (library (subsublib)
>  (export blue)
>  (import (rnrs))
>  (define (blue) 123))
>
> (library (sublib)
>  (export h)
>  (import (rnrs) (for (subsublib) (meta -1)))
>  (define h
>    (make-eq-hashtable))
>  (hashtable-set! h 'b (syntax blue)))
>
> (library (lib)
>  (export thing)
>  (import (rnrs) (for (sublib) expand))
>  (define-syntax thing
>    (lambda (stx)
>      (syntax-case stx ()
> 	((_)
> 	 (with-syntax ((f (hashtable-ref h 'b #f)))
> 	   #'(f)))))))
>
> (import (rnrs) (lib))
> (write (thing))
>
> so the  fact that the identifier  has to be  imported in the
> library  defining the  macro  transformer is  not the  whole
> story...

Very interesting.

Maybe r7rs can be persuaded to address this kind of thing.  It should certainly 
be raised for discussion when the time comes.

Until then, I don't think this kind of thing can be expected to
work portably across implementations, or even consistently within a
given implementation, since use cases similar to this can subvert
the normal static determination of import dependencies.

I would consider the permissiveness of all the above implementations
to be a bug, but it would be interesting to hear different points of
view.

Andre



More information about the Larceny-users mailing list