From: "Ludovic Courtès" <ludo@gnu.org>
To: Andy Wingo <wingo@igalia.com>
Cc: 39634@debbugs.gnu.org, Rob Browning <rlb@defaultvalue.org>
Subject: bug#39634: All keyowrds hash to the same value
Date: Fri, 06 Mar 2020 15:42:20 +0100 [thread overview]
Message-ID: <87sgilmto3.fsf@gnu.org> (raw)
In-Reply-To: <87h7zeo06f.fsf@igalia.com> (Andy Wingo's message of "Tue, 25 Feb 2020 21:56:56 +0100")
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
Andy Wingo <wingo@igalia.com> skribis:
>> variable,
>> hashtable,
>> fluid,
>> dynamic_state,
>> frame,
>> atomic_box,
>> program,
>> vm_cont,
>> weak_set,
>> weak_table,
>> port
>
> No equal? implementation, so should hashq() instead.
Here’s a patch for these, let me know what you think!
(Of course longer term it’d be nice to have a centralized way to declare
each tc7 with its equal and hash methods.)
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1053 bytes --]
diff --git a/libguile/hash.c b/libguile/hash.c
index c51a794c9..9cb8fcedd 100644
--- a/libguile/hash.c
+++ b/libguile/hash.c
@@ -1,4 +1,4 @@
-/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018
+/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018,2020
Free Software Foundation, Inc.
This file is part of Guile.
@@ -331,6 +331,22 @@ scm_raw_ihash (SCM obj, size_t depth)
h ^= scm_raw_ihash (scm_syntax_module (obj), depth);
return h;
}
+
+ /* The following tc7s have no 'equal?' implementation. Thus, just
+ fall back to 'hashq'. */
+ case scm_tc7_variable:
+ case scm_tc7_hashtable:
+ case scm_tc7_fluid:
+ case scm_tc7_dynamic_state:
+ case scm_tc7_frame:
+ case scm_tc7_atomic_box:
+ case scm_tc7_program:
+ case scm_tc7_vm_cont:
+ case scm_tc7_weak_set:
+ case scm_tc7_weak_table:
+ case scm_tc7_port:
+ return scm_raw_ihashq (SCM_UNPACK (obj));
+
case scm_tcs_cons_imcar:
case scm_tcs_cons_nimcar:
if (depth)
next prev parent reply other threads:[~2020-03-06 14:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-16 18:20 bug#39634: All keyowrds hash to the same value Rob Browning
2020-02-20 16:19 ` Ludovic Courtès
2020-02-25 20:56 ` Andy Wingo
2020-02-25 22:13 ` lloda
2020-02-26 21:02 ` Ludovic Courtès
2020-03-06 14:42 ` Ludovic Courtès [this message]
2020-03-06 15:43 ` Andy Wingo
2020-03-06 16:19 ` Ludovic Courtès
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=87sgilmto3.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=39634@debbugs.gnu.org \
--cc=rlb@defaultvalue.org \
--cc=wingo@igalia.com \
/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).