[plt-scheme] Native code generation and immutable pairs

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Feb 12 00:01:26 EST 2006

At Sat, 11 Feb 2006 20:53:08 -0800, Jim Blandy wrote:
> On 2/11/06, Robby Findler <robby at cs.uchicago.edu> wrote:
> > I don't know if anyone answered your question, but yes. We are
> > considering that and have been for a long time. Partly because it
> > improves analyses like you suggest, but more because it makes it easier
> > to reason about programs using immutable conses (and contract systems
> > work better when structures are immutable). In particular, you can hand
> > out the same list multiple times from a library without having to worry
> > about copying it to be safe/correct.
> What were your thoughts about the flip side argument: that it's
> valuable to treat mutable pairs as a subtype of pairs?  SRFI-1 thought
> it valuable to provide an extensive set of "linear" operators; and the
> body of code distributed with MzScheme seems to use set-car! and
> set-cdr! quite a bit.

I don't think that mutable pairs can be a subtype of pairs since
mutable pairs are not substitutable for ordinary pairs. That is, code
that works when given immutable pairs may fail to work when given
mutable pairs (that is, if the pairs are mutated in some unexpected

> In other words, how do you folks feel about what you'd be giving up?

My sense is that we occasionally need mutation, but we get a lot by
giving it up (and there's always mutable pairs and mutable records via
define-struct in some variation that's not going away). But, I'm just
speaking for myself.


Posted on the users mailing list.