all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Comparing hash table objects
Date: Sun, 12 Jun 2022 19:55:08 -0400	[thread overview]
Message-ID: <87leu1l9nn.fsf@gnu.org> (raw)
In-Reply-To: <jwvv8t7chvr.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 11 Jun 2022 12:04:46 -0400")

> * Stefan Monnier <zbaavre@veb.hzbagerny.pn> [2022-06-11 12:04:46 -0400]:
>
>> However, it will not help with the problem of comparing objects
>> containing hash tables. Unless those obejcts also define special
>> comparison function (which is inconvenient).
>
> This is an instance of a fairly general problem with Lisp's equality
> tests (and it's not really specific to Lisp, admittedly).

Sadly, this is true.

> Maybe a half-sane way to solve this problem is to provide a generic
> "equality driver" which takes an argument specifying which objects to
> compare for structural equality (i.e. where to keep recursing).

The way Python does it could be a good starting point:
unless a class defines __eq__ method, the comparison is Lisp eq.
So, if a class has structure, it should define the comparison method.
See https://docs.python.org/3/reference/datamodel.html#object.__eq__

-- 
Sam Steingold (http://sds.podval.org/) on Pop 22.04 (jammy) X 11.0.12101003
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://ij.org/ http://think-israel.org https://fairforall.org
(let ((a "(let ((a %c%s%c)) (format a 34 a 34))")) (format a 34 a 34))



  parent reply	other threads:[~2022-06-12 23:55 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  8:41 Comparing hash table objects Ihor Radchenko
2022-06-08  8:51 ` Andreas Schwab
2022-06-08  9:17   ` Ihor Radchenko
2022-06-10 22:45     ` Richard Stallman
2022-06-11  5:52       ` Ihor Radchenko
2022-06-11 16:04         ` Stefan Monnier
2022-06-12  9:16           ` Ihor Radchenko
2022-06-12 23:55           ` Sam Steingold [this message]
2022-06-13 13:02             ` Stefan Monnier
2022-06-13 16:18               ` Sam Steingold
2023-05-15  5:56 ` bug#63513: [PATCH] Make persist-defvar work with records and hash tables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15 11:31   ` Eli Zaretskii
2023-05-23 20:14     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02 23:54       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03  6:08         ` Eli Zaretskii
2023-09-04  0:29           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 11:33             ` Eli Zaretskii
2023-09-04 15:57               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 17:05                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 22:28                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 21:06                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 11:30                       ` Ihor Radchenko
2023-09-08 11:58                         ` Eli Zaretskii
2023-09-08 12:06                           ` Ihor Radchenko
2023-09-08 12:46                             ` Eli Zaretskii
2023-09-08 12:51                               ` Ihor Radchenko
2023-09-08 16:36                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 17:06                           ` Ihor Radchenko
2023-09-08 17:10                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-09 10:01                               ` Ihor Radchenko
2023-09-09 10:15                                 ` Daniel Mendler
2023-09-09 11:35                                   ` Ihor Radchenko
2023-09-09 11:57                                     ` Daniel Mendler
2023-09-09 12:12                                       ` compat.el and Emacs unstable master branch features (was: bug#63513: [PATCH] Make persist-defvar work with records and hash tables) Ihor Radchenko
2023-09-09 12:29                                         ` Daniel Mendler
2023-09-09 16:52                                           ` Joseph Turner
2023-09-11  8:45                                           ` Ihor Radchenko
2023-09-12 10:02                                             ` compat.el and Emacs unstable master branch features Philip Kaludercic
2023-09-12 10:27                                               ` Daniel Mendler
2023-09-13 10:31                                                 ` Philip Kaludercic
2023-09-13 17:11                                                   ` Daniel Mendler
2023-10-15  8:43                                                     ` Ihor Radchenko
2023-10-15 12:09                                                       ` Philip Kaludercic
2023-09-05 15:08                   ` bug#63513: [PATCH] Make persist-defvar work with records and hash tables phillip.lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87leu1l9nn.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.