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

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

bug#56255: 28.1.50; sxhash-equal does not change when object is modified


From: Lars Ingebrigtsen
Subject: bug#56255: 28.1.50; sxhash-equal does not change when object is modified
Date: Tue, 28 Jun 2022 00:56:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Ihor Radchenko <yantar92@gmail.com> writes:

> The result of sxhash-equal does not change despite `a' object being
> changed.

Here's a self-contained example:

(require 'org-element)
(setq c (avl-tree--create #'org-element--cache-compare))
(avl-tree-enter c '(headline (:begin 2)))

(setq d (avl-tree--create #'org-element--cache-compare))
(avl-tree-enter d '(headline (:begin 5)))

(equal c d)
nil

(sxhash-equal c)
1776904311275
(sxhash-equal d)
1776904311275

This is due to:

/* Maximum depth up to which to dive into Lisp structures.  */
#define SXHASH_MAX_DEPTH 3

Since this record nests to a depth of 4, and that's where the difference
is.

So I think the doc string overstates things. 

--
If (equal A B), then (= (sxhash-equal A) (sxhash-equal B)).
--

Is not remotely true, but:

--
If (= (sxhash-equal A) (sxhash-equal B)) then it's quite likely that
(equal A B), but the opposite is not true for deeply nested structures.
--



-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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