bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#39529: 28.0.50; Metahelp does not contain help text


From: Paul Eggert
Subject: bug#39529: 28.0.50; Metahelp does not contain help text
Date: Tue, 18 Feb 2020 17:21:58 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2/18/20 11:56 AM, Pip Cet wrote:

if we rely on the precise
definitions of XHASH etc. that were in place prior to the January
changes, no "quick fix" was needed; it was simply the case that the
predicate used by hash tables created with :test equal diverged from
the built-in `equal' predicate in one more way than was already
documented. (Those documented deviations are that mutations of hash
keys won't cause rehashing, and that equal will sometimes signal for
(equal a b) but not for (equal b a)).

I'm not aware of these deviations - where are they documented?

What I see in the Emacs 27 documentation, under "Defining Hash Comparisons", is the statement that the hash and equality functions' "behavior should depend on only on properties of the keys that do not change". This is true of 'equal' and 'sxhash-equal' if one does not mutate any key that's in the hash table. So from what I can see, the predicates are supposed to be the same, it's just that one can't mutate keys.

Also, I don't understand what is meant by "the predicate used by hash tables created with :test equal diverged from the built-in `equal' predicate". cmpfn_equal simply calls Fequal, so how can their behaviors diverge?

The pure-cons hash, and many other places, assume "equal" means
"equivalent" in some way. That's not true for bytecode objects, where
a function always returning `nil' can be equal to one always returning
`t'.

Could you give an example of this? When I byte-compiled this:

(defun f () (let ((x '(#1=(nil) . #1#)))
           (eq (car x) (cdr x))))
(defun g () (let ((x '((nil) . (nil)))
           (eq (car x) (cdr x))))

That's somewhat contrived; more realistic examples where this might
actually be a problem would use string properties.

Although this example is a good one that illustrates a bug (or at least a poorly-documented feature) in dumping, it hasn't changed because of the January 7 changes to sxhash. The same issue exists in Emacs 27 (and in Emacs 26 for that matter). So I'd rather address this issue separately, perhaps simply by documenting it for now.

I'll propose one more thing, which sounds horrible at first but might
be the least horrible option: accept that `equal', the function, and
`:test equal', the hash table predicate, have diverged significantly
already.
Again I'm not following, because the two functions haven't diverged as far as I can see.





reply via email to

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