[racket] feedback on migrating to immutable pairs?

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sun Jun 13 02:59:45 EDT 2010

On Sun, Jun 13, 2010 at 7:51 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> Two questions on the move to immutable pairs:
> 1. Does anyone have feedback on how that went?  (The only problems I recall
> dealing with personally were pain for HtmlPrag, a minor change to the "csv"
> library, and a small headache supporting SICP.)

For the Untyped code base this was virtually a non-issue.

> 2. What was the rationale for not having "pair?", "car", "cdr", work on both
> mutable pairs and immutable pairs?  Was this to push everyone harder towards
> immutable pairs, at the cost of having to convert legacy libraries and
> breaking R5RS compatibility?

Neither is a subtype of the other. Mutable pair break the invariants
expected of immutable pairs, and immutable pairs don't support all the
operations of mutable pairs. Given this you're just asking for
confuzzlement if you elide the difference with pair?, car, and cdr --
in the same way that + doesn't work for strings and numbers, these
functions shouldn't work for pair?, car, and cdr.


Posted on the users mailing list.