chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] This may be a bug in chickens hash tables - or my ba


From: Peter Bex
Subject: Re: [Chicken-users] This may be a bug in chickens hash tables - or my bad
Date: Wed, 16 Dec 2015 21:55:38 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Dec 16, 2015 at 09:47:31PM +0100, Jörg F. Wittenberger wrote:
> Hi,
> 
> I always assumed that (make-hash-table eq?) would create a hash table
> usable with arbitrary chicken objects as keys.
> 
> That is especially structures like objects created via define-record
> should be valid as keys.  That is: referencing the table using the very
> same object (comparing eq? to the key object of the insert operation)
> will succeed.
> 
> However this fails for me.  At least after the key object was mutated
> between insert and reference time.
> 
> See attached test case.
> 
> Am I trying something illegal here?
> 
> Thanks
> 
> /Jörg

> (use srfi-69)
> 
> (define objtbl (make-hash-table eq?))
> 
> (define (register! obj arg)
>   (hash-table-update! objtbl obj identity (lambda () (list obj arg))))
> 
> (assert (eq? (register! 1 1) (register! 1 2)))

I believe the return value of hash-table-update! is undefined.

Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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