Re: [PATCH] Implement `equal' for hash tables
Richard Stallman <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
[[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > If hash table insertion order matters, then the equal operation would need > an argument to compare (nested) hash tables in an order-insensitive way. Does insertion order of items in a hash table ever matter in Emacs? This text in the Lisp Ref Manual seems to say it does not: • The correspondences in a hash table are in no particular order. The manual says that hash tables print by showing their contents, and can be read back. This suggests that they should compare based on their contents, too. Compatibility may be important, but do any programs depend on what happens when comparing hash tables with `equal'? > And perhaps some custom comparator logic to handle things like json > dates/times and the rest of the under-and un-specified mess that passes for > some data-interchange formats/protocols. Each hash table could have a comparison-function slot which would say how to decide it and another hash table are equal. You could specify nil for eq, t for equal, or something more specific and smarter. If two hash tables have different comparison-function values, they could compare using eq. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)