chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] R6RS immutable pair


From: Kon Lovett
Subject: Re: [Chicken-users] R6RS immutable pair
Date: Wed, 12 Jul 2006 20:53:34 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jul 12, 2006, at 2:42 PM, John Cowan wrote:

Kon Lovett scripsit:

<snip>

I'd like to see the existing pairs left alone, and new immutable pairs
without identity added. That is, (immutable-cons 1 2) is permitted (but
not required) to return the same pair (in the sense of EQ?) every time
it's called.

Hash-Consing?


All existing procedures would continue to work with immutable pairs
except, of course, SET-CAR! and SET-CDR!.  Some decision would have to
be taken about procedures like APPEND that accept multiple arguments:
my initial take is that they should produce immutable results unless
all the arguments are mutable.

You are suggesting contagion. I use this in the 'procedure-surface' composite for example.


Scheme would need new procedures MUTABLE-PAIR?, IMMUTABLE-PAIR?,
IMMUTABLE-CONS, IMMUTABLE-LIST, MUTABLE->IMMUTABLE, and
IMMUTABLE->MUTABLE.

Mutable vs. Immutable should be a property of the object. Sorry, but I don't think we need *-immutable versions of every (<proc> <datatype> ...). Just a built-in flag and exception when a mutating operation attempted.

I think the R6RS editors are interested in Scheme source compiled. If it can be inferred that a datum is immutable then optimizations can be applied.


--
John Cowan   address@hidden    http://ccil.org/~cowan
Original line from The Warrior's Apprentice by Lois McMaster Bujold:
"Only on Barrayar would pulling a loaded needler start a stampede toward one." English-to-Russian-to-English mangling thereof: "Only on Barrayar you risk to lose support instead of finding it when you threat with the charged weapon."

Yes, the "Miles" stories are a fun read.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iEYEARECAAYFAkS1w74ACgkQJJNoeGe+5O7tUgCeMT/nMWe+gEeYszZG+gTzESN0
bhYAni5UBC4MI0yy+KlLx6prs+FjmDQG
=hRDp
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]