bug#39634: All keyowrds hash to the same value

Ludovic Courtès <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Hi Rob,

Rob Browning <[email protected]> skribis:

>>From b380102564aad053f22586eb404e99c82635a3b0 Mon Sep 17 00:00:00 2001
> From: Rob Browning <[email protected]>
> Date: Sun, 16 Feb 2020 12:12:08 -0600
> Subject: [PATCH 1/1] Implement hashing for keywords, i.e. (hash #:x ...)
>
> Add keyword handling to (hash ...).  Previously it would just return the
> same value for all keywords.
>
> * libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case.
>
> * libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro.

LGTM, please push!

Andy and I discussed it on IRC and despite the fact that it’s an ABI
change, we thought including the fix in 3.0.1 was probably the better
option.

Of all the scm_tc7_ values listed in ‘scm.h’, the following are not
explicitly listed (so they go to the default case that hashes the first
word):

  variable, hashtable, fluid, stringbuf, dynamic_state, frame,
  atomic_box, values, program, vm_cont, bytevector, weak_set,
  weak_table, array, bitvector, port

So for example all input file ports hash to the same value, all
3-element bytevectors hash to the same value, etc.

We can probably omit stringbuf, dynamic_state, and values, but the rest
should probably be fixed.

WDYT, Andy?

Thanks,
Ludo’.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.