[plt-scheme] Re: R6RS Interoperability

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jun 27 12:06:48 EDT 2008

At Fri, 27 Jun 2008 05:27:37 +0000 (UTC), Tom Gordon wrote:
> Matthew Flatt <mflatt at ...> writes:
> > FWIW, supporting an "R6RS but with immutable pairs" language is part of
> > the plan:
> > 
> >   http://list.cs.brown.edu/pipermail/plt-scheme/2008-March/023485.html
> > 
> > But we haven't gotten there, yet.
> Here's the relevant passage from your earlier message:
> "... R6RS pairs are mutable, which means that R6RS libraries
> and `scheme/base' have incompatible notions of pairs and lists. We
> expect that few R6RS libraries will need `(r6rs mutable-pairs)'
> library, directly or transitively, in which case they can be trivially
> translated to an "R6RS/i" variant of R6RS with immutable pairs --- and
> then interoperate smoothly with PLT Scheme code. We plan to implement
> this variant of R6RS and provide a way to translate and install a given
> set of R6RS libraries as R6RS/i libraries."
> Are you suggesting the R6RS requires pairs to be mutable?   Couldn't the 
> decision of R6RS to move mutable pairs to a library be understood as 
> deprecating mutable pairs and allowing, even encouraging, 
> pairs to be immutable in modules which do not depend 
> on (r6rs mutable-pairs)?

Certain R6RS implementations might take advantage of the fact that
`(r6rs mutable-pairs)' and `(r6rs eval)' are not used in a whole
program to adjust the compilation/interpretation strategy for the
program. That doesn't work in our implementation, because of the way we
compile libraries separately.

The R6RS editors weren't certain what to do about mutable pairs. I
think we felt like they should go away, but we didn't have enough
experience with the change to be sure that it was practical. So we
settled on the conservative step of banishing `set-car!' and `set-cdr!'
to a separate library. Now, of course, PLT Scheme 4.0 is filling the
gap in experience, and perhaps future standards authros will take the
results into account.

> Does you plan really introduce a 
> "variant" of R6RS, or isn't it rather just a step towards optimizing 
> your implemention of R6RS, completely in line with the standard?

Really a "variant", in the sense that whether pairs are mutable will be
determined at the library level, as opposed to being part of a
whole-program optimization.

It's easy to imagine a flag to `plt-r6rs' that means "compile and
optimize this whole R6RS program". If immutable pairs eventually have
some performance advantage (which is not the case yet, I think), then
that might be useful. I don't think it help much with using PLT Scheme
libraries from R6RS programs, though.


Posted on the users mailing list.