[racket] feedback on migrating to immutable pairs?
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.
N.