chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #1293: Locatives get moved around causing hash ta


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1293: Locatives get moved around causing hash tables to lose them
Date: Tue, 23 Aug 2016 19:15:41 -0000

#1293: Locatives get moved around causing hash tables to lose them
-----------------------------+---------------------------------------------
  Reporter:  sjamaan         |      Owner:
      Type:  defect          |     Status:  new
  Priority:  major           |  Milestone:  4.12.0
 Component:  core libraries  |    Version:  4.10.x
Resolution:                  |   Keywords:  srfi-69, hash tables, locatives
-----------------------------+---------------------------------------------

Comment (by sjamaan):

 It looks like the real problem is that `eq?` hash tables don't work as
 you'd expect: If you mutate an object, it's still `eq?` to its previous
 incarnation (if there were such a thing), but the hash function calculates
 a **different hash**:

 {{{
 #;1> (use srfi-69)
 ; loading /home/sjamaan/chickens/4.11.0/lib/chicken/8/srfi-69.import.so
 ...
 ; loading library srfi-69 ...
 #;2> (define x (cons 1 2))
 #;3> (hash-by-identity x)
 380849329
 #;4> (set-car! x 3)
 #;5> (hash-by-identity x)
 380718257
 #;6> (= #3 #5)
 #f
 #;7>
 }}}

 This is completely broken, and it seems that the reference implementation
 has the exact same bug in `hash-by-identity`.

 Racket and Guile seem to do this correctly, even mutation of a pair
 doesn't result in a new hash value.

 I have no idea how to fix this, as of yet...

--
Ticket URL: <http://bugs.call-cc.org/ticket/1293#comment:2>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

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