[R6RS] libraries
dyb at cs.indiana.edu
dyb
Fri Dec 9 15:57:07 EST 2005
> I was personally thinking (implicitly, I now realize) that
> "immutability" referred to the fact that the SET! on a top-level
> variable defined in a module has to be in the body of that same
> module.
Okay, so the variables aren't actually immutable at all...their values
can change over time, but the the agent of change has to be code in the
exporting module's body. In particular,
(library S "scheme://r6rs"
(export P!)
(define s '())
(define (P! y) (set! s (cons y s))))
(library T "scheme://r6rs"
(import S)
(export P0!)
(define (P0!) (P! 0)))
is acceptable, right? What about:
(library S "scheme://r6rs"
(export P!)
(define s '())
(define-syntax P!
(syntax-rules ()
[(_ y) (set! s (cons y s))]))
(library T "scheme://r6rs"
(import S)
(export P0!)
(define (P0!) (P! 0)))
The set! to s appears in the body of S, so by a literal reading of your
response, it should be okay. Or you may have meant that the set! has
to appear in the residual code (post macro expansion) of the body of
the exporting module. Which do you intend?
Kent
More information about the R6RS
mailing list