[r6rs-discuss] immutable hash tables and eqv?

From: Alexander Kjeldaas <alexander.kjeldaas>
Date: Thu, 24 May 2007 19:39:12 +0200

On 5/24/07, R. Kent Dybvig <dyb at cs.indiana.edu> wrote:
>
> I think this decision to (un)specify eqv? in this manner was a mistake
> and hope we can agree to fix the mistake. If we do, I expect that it will
> continue to work the same for hashtables as it does for records.
>
> Incidentally, one reason I think it's a mistake is that it destroys the
> programmer's ability to use eq? or eqv? hashtables with immutable pairs,
> vectors, records, etc., as keys. So, for example, I can't use hashtables
> to virtually add properties to an existing immutable object. To make
> this more concrete, suppose I want to use a hashtable to record source
> information on an s-expression, and I haven't imported the mutable-pairs
> library. Then I can't reliably retrieve the source information from the
> hashtable because the implementation is not required to make eqv? or eq?
> work for the immutable pairs that make up portions of the s-expression.



I am thinking of an example where you want to create a library for
communicating sequential processes in scheme. You want the messages passed
between the processes to be immutable to ensure that there is no other way
for the "processes" to communicate. Not being able to emulate this
programming idiom within the scheme language just seems wrong to me. The
minimum support you need for this is to be able to convert a general data
structure into an immutable data structure. Maybe this is possible, I don't
know.

But as long as the implementation is not required to signal anything when
storing into an immutable object, the CSP library can't guarantee anything,
so scheme would still not be able to emulate CSP-style programming.

It would be good to require support for immutable objects in scheme. It
would not be harder than having a bit for every object for simple
implementations, and for implementations with fancy GCs or threaded schemes,
it could improve performance by simplifying the write barrier for the memory
area containing immutable data. For distributed versions of scheme, it
would make it easy to write CSP-style scheme.

Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r6rs.org/pipermail/r6rs-discuss/attachments/20070524/98b127d5/attachment-0001.htm
Received on Thu May 24 2007 - 13:39:12 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC