[R6RS] libraries

Michael Sperber sperber
Sat Dec 10 11:49:55 EST 2005


dyb at cs.indiana.edu writes:

>> 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.

Yes, this should also be acceptable.

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla


More information about the R6RS mailing list