emacs-devel
[Top][All Lists]
Advanced

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

Re: Comparing hash table objects


From: Sam Steingold
Subject: Re: Comparing hash table objects
Date: Mon, 13 Jun 2022 12:18:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

> * Stefan Monnier <zbaavre@veb.hzbagerny.pn> [2022-06-13 09:02:41 -0400]:
>
> Sam Steingold [2022-06-12 19:55:08] wrote:
>> 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__
>
> Seems like the exact same way ELisp works.

including for user-defined classes?!

> The problem we have right now (translated into Python) is that some

please use ELisp terminology too for those who will want to read the sources.

> people now want to add a `__eq__` method to the class `hash-table`
> (they argue that the lack of it was an oversight).

sounds about right.

> It's easy to do what they ask for, but it breaks backward
> compatibility.

I would argue that code relying on `equal' being the same as `eq' for
`hash-table' is a bug.  Exposing such a bug might be painful, but it
should be fixed anyway.

Thank you for your clarifications.

-- 
Sam Steingold (https://youtube.com/channel/UCiW5WB6K4Fx-NhhtZscW7Og) on darwin 
Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://ij.org/ https://ffii.org https://memri.org https://jij.org
He who laughs last thinks slowest.



reply via email to

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