[R6RS] libraries

Anton van Straaten anton
Tue Dec 13 19:09:19 EST 2005

Marc Feeley wrote:
> Then, as I said previously, it seems more consistent with the Scheme  
> design approach to have mutable bindings everywhere.  

I don't think the Scheme design approach is as clear-cut as that. 
Chapter 6 of R5RS says that "Altering any top-level binding that has not 
been introduced by a definition has an unspecified effect on the 
behavior of the built-in procedures".

One natural extension of this into the context of libraries would imply 
that mutating an imported binding should have an unspecified effect on 
the behavior of the imported procedures.

I suspect that we will all want to be more specific about how this works 
for libraries, though.  Looking at how existing Schemes treat this 
issue, none of the implementations I'm familiar with allow e.g. (set! 
car cdr) to affect the behavior of built-in procedures like cadr or map. 
  There are implementation-oriented reasons for this, of course, but it 
also protects the built-in procedures from being damaged by outside 

My reasons for wanting protection against mutation of imported bindings 
center around the latter point.  In other languages, such protection is 
often achieved by only exporting accessor procedures instead of the 
underlying variables.  However, in Scheme, procedure bindings are 
mutable, which makes it difficult for a library to protect itself from 
arbitrary outside interference.

Whether or not it is consistent with the Scheme design approach, if R6RS 
libraries cannot easily protect themselves in the same way that e.g. 
R5RS library procedures are usually protected, it's a concern which I 
think should be addressed.


More information about the R6RS mailing list