[R6RS] libraries
dyb at cs.indiana.edu
dyb
Sun Dec 11 06:27:32 EST 2005
> > Good point---I think I understand your criteria. Would this be okay,
> > then?
> >
> > (library S "scheme://r6rs"
> > (export A P! s)
> > (define s '())
> > (define-syntax A
> > (syntax-rules ()
> > [(_ p x) (p s x)]))
> > (define-syntax P!
> > (syntax-rules ()
> > [(_ x y) (set! x (cons y s))])))
> > (library T "scheme://r6rs"
> > (import S)
> > (export P0!)
> > (define (P0!) (A P! 0)))
> >
> > I assume so, since both the set! and reference to 's' are within S.
>
> Yes.
So any identifier that leaks out of a module is fair game as long as
the module itself exports some sort of assignment abstraction. So,
I presume, this is okay too:
(library S "scheme://r6rs"
(export A P! s)
(define s '())
(define-syntax A
(syntax-rules ()
[(_ p x) (p 's x)]))
(define-syntax P!
(syntax-rules ()
[(_ x y) (set! x (cons y s))])))
(library T "scheme://r6rs"
(import S)
(export P0!)
(define-syntax dequote-P!
(syntax-rules (quote)
[(_ (quote x) e) (P! x e)]))
(define (P0!) (A dequote-P! 0)))
Again, both the set! and "reference" to s appear in the exporting module.
Kent
More information about the R6RS
mailing list