[R6RS] libraries

Anton van Straaten anton
Mon Dec 12 00:01:47 EST 2005


dyb at cs.indiana.edu wrote:
> So, while I think I can probably implement your modified semantics (both
> set! and lhs id must originate in the exporting module), it's only one
> of several possible interpretations of "settable only by the exporting
> module", and I believe it will lead to confusion.  Your semantics
> also falls short of supporting program analysis in the way that true
> external immutability would, negating one of the potential benefits
> of immutability.
> 
> I'm happy to compromise on the mutability issue and make module exports
> immutable if all exports (direct or indirect) are totally immutable,
> so that we avoid confusion and support program analysis.  

By "totally immutable", do you mean to disallow even the exporting 
module from mutating its own exported variables?  Or do you mean the 
option you described earlier, "set! has to appear in the residual code 
(post macro expansion) of the body of the exporting module."

I'm in favor of the latter.  It prevents the problem raised by the 
example you've just given, and in general, it should prevent external 
mutation of variables which the exporting module did not intend to allow 
to be mutated.  This seems to me a good rationale for this particular 
interpretation of "settable only by the exporting module".

Anton



More information about the R6RS mailing list