[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expose XHASH [patch]
From: |
Stefan Monnier |
Subject: |
Re: expose XHASH [patch] |
Date: |
Thu, 31 Mar 2016 17:52:51 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> Please don't write that the example is stupid, it is just an
> example after all.
FWIW, I have bumped into various cases where I also needed to define
a hash for an equality function that's defined for example as (and (eq
(car x) (car y)) (eq (cdr x) (cdr y))). Worse yet: you say that "sxhash
_will_ work" but in reality it won't if the objects are later modified
by side-effects.
See for example:
(cl--generic-with-memoization
;; FIXME: Since the fields of `generic' are modified, this
;; hash-table won't work right, because the hashes will change!
;; It's not terribly serious, but reduces the effectiveness of
;; the table.
(gethash (cons generic methods)
cl--generic-combined-method-memoization)
from cl-generic.el. I wrote "It's not terribly serious", but IIRC there
can be cases where it causes real problems.
So a big "yes please" from me.
Stefan