bug-guile
[Top][All Lists]
Advanced

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

bug#39634: All keyowrds hash to the same value


From: Ludovic Courtès
Subject: bug#39634: All keyowrds hash to the same value
Date: Thu, 20 Feb 2020 17:19:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Rob,

Rob Browning <address@hidden> skribis:

>>From b380102564aad053f22586eb404e99c82635a3b0 Mon Sep 17 00:00:00 2001
> From: Rob Browning <address@hidden>
> 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’.





reply via email to

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