Re: [PATCH] Implement `equal' for hash tables

Björn A. Lindqvist <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
On 8/16/26 15:17, Stéphane Marks wrote:
> If hash table insertion order matters, then the equal operation would 
> need an argument to compare (nested) hash tables in an order-insensitive 
> way.  I believe the Java Jackson package's equal operation ignores 
> element order.  It's been a while in Python but IIRC, one has to perform 
> key sorting shenanigans to compare json documents parsed into a 
> dictionary.  

Nope, in Python insertion order preservation is purely a quality of life 
feature:

In [1]: {"a" : "b", "c" : "d"} == {"c" : "d", "a" : "b"}
Out[1]: True

> And then there are the data type comparator issues where 
> two json documents might be "human equal" but not technically equal; the 
> most common thing I've seen is that json has no standards for dates and 
> times so it's a mess +/- your level of control over the json documents.

Right, it's similar to case (in)sensitivity or even propertized strings:

(equal (propertize "a" 'face '(:foreground "red"))
        (propertize "a" 'face '(:foreground "green")))
t

Someone has to decide what "equals" mean. For container types, the (by 
far) most common "equals" is pairwise equality among all contained 
elements.


-- 
mvh Björn Lindqvist
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.