From: Neil Jerram <INVALID.NOREPLY@gnu.org>
To: Neil Jerram <neil@ossau.uklinux.net>,
Gregory Marton <gremio@mit.edu>,
bug-guile@gnu.org
Subject: [bug #22022] hashx-set! and -ref
Date: Thu, 17 Jan 2008 22:45:58 +0000 [thread overview]
Message-ID: <20080117-224557.sv185.59357@savannah.gnu.org> (raw)
In-Reply-To: <20080117-215736.sv185.71494@savannah.gnu.org>
Follow-up Comment #3, bug #22022 (project guile):
And here are all the remaining ones. I've added a (pk ...) in each case, so
the output from make check shows what the actual hash?-ref value was.
;;; (#f)
FAIL: hash.test: auto-resizing hashx: (equal? (quote eq) (pk (hashq-ref table
4)))
;;; (#f)
FAIL: hash.test: auto-resizing hashx: (equal? (quote equal) (pk (hashx-ref
hash equal? table 1/32)))
;;; (#f)
FAIL: hash.test: auto-resizing hashx: (equal? (quote eqv) (pk (hashx-ref
hashv eqv? table 1/33)))
;;; (#f)
FAIL: hash.test: auto-resizing hashx: (equal? (quote eq) (pk (hashx-ref hashq
eq? table 34)))
These cases, together with the neighbouring ones that happen to pass, are
actually out of scope, because the manual says (5.6.12.2 Hash Table
Reference):
-----------manual------------
Like the association list functions, the hash table functions come in
several varieties, according to the equality test used for the keys.
Plain `hash-' functions use `equal?', `hashq-' functions use `eq?',
`hashv-' functions use `eqv?', and the `hashx-' functions use an
application supplied test.
A single `make-hash-table' creates a hash table suitable for use
with any set of functions, but it's imperative that just one set is
then used consistently, or results will be unpredictable.
-----------manual------------
The rationale for this is what happens when a hash table is resized. When
that happens, the new hash buckets (vector indices) are recalculated, for all
existing entries in the table, using the hash function that was specified on
the call that caused the resize. If that hash function is different from the
hash that is later used to try to query particular entries, Guile can look in
the wrong bucket, and the expected entry won't be found.
There's another case, too, where a rehash is done following GC, using a hash
function that was stored at some point in the hashtable data structure. But I
haven't got right into that, because I think we already have enough to rule
these test cases invalid.
What do you think?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?22022>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
next prev parent reply other threads:[~2008-01-17 22:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-14 22:40 [bug #22022] hashx-set! and -ref Gregory Marton
2008-01-17 21:52 ` Neil Jerram
2008-01-17 21:54 ` Gregory Marton
2008-01-17 23:02 ` Neil Jerram
2008-01-18 0:25 ` Gregory Marton
2008-01-17 21:57 ` Neil Jerram
2008-01-17 22:01 ` Gregory Marton
2008-01-17 22:45 ` Neil Jerram [this message]
2008-01-18 0:22 ` Gregory Marton
2008-01-29 22:28 ` Neil Jerram
2008-12-07 16:51 ` Neil Jerram
2008-01-17 23:13 ` Neil Jerram
2008-01-18 0:30 ` Gregory Marton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080117-224557.sv185.59357@savannah.gnu.org \
--to=invalid.noreply@gnu.org \
--cc=bug-guile@gnu.org \
--cc=gremio@mit.edu \
--cc=neil@ossau.uklinux.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).