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

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to