From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.devel Subject: Re: Comparing hash table objects Date: Sun, 12 Jun 2022 19:55:08 -0400 Message-ID: <87leu1l9nn.fsf@gnu.org> References: <871qvz4kdw.fsf@localhost> <87leu7tsyc.fsf@localhost> <878rq3d9wm.fsf@localhost> Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19547"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: emacs-devel@gnu.org, Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 13 01:56:46 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o0XRk-0004vJ-UA for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Jun 2022 01:56:44 +0200 Original-Received: from localhost ([::1]:40396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0XRj-0001Yq-IL for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Jun 2022 19:56:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0XQQ-0000m0-Ns for emacs-devel@gnu.org; Sun, 12 Jun 2022 19:55:22 -0400 Original-Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:46041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0XQH-0007jS-L2; Sun, 12 Jun 2022 19:55:22 -0400 Original-Received: by mail-qv1-xf2e.google.com with SMTP id ea7so3356293qvb.12; Sun, 12 Jun 2022 16:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:in-reply-to:references:user-agent :return-receipt-to:reply-to:mail-followup-to:date:message-id :mime-version; bh=+f2XY6SZW3cyzQY1qW//wiMcxHbe00MG8CLq8Nj0cdg=; b=lpK6JuicIa4fAb/7X+4J7vzdUjYInmCoVzICUhdIkAcx1/78KxJZ9gYgDR/Y6pcZfE 8wyLHozrCJwxSB1EYsWaHT6OZTEtN0KTF03KEpZpOtUCkB5T0fjoXr/o0eZSQIZVMRzB jL+MRhbk3simZFnntuaIdwJB2AU93RKUxOvRdvrcmcEaKfGtmb8JKrnqp7avAx6K6vby LgWldAEKL2iZxm1ibhWb4Xt+NVHMydOY8LZZ8fdUsn+kk4hO2dQM8gLJ/eFcFL9ni8PR cj6CYRCNCMcpzFDCOG2fI5ig8aahcO2AArqMxC8W+DkzcdVCyafBAcDNKtNnTmXHVKjg OKwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:in-reply-to:references :user-agent:return-receipt-to:reply-to:mail-followup-to:date :message-id:mime-version; bh=+f2XY6SZW3cyzQY1qW//wiMcxHbe00MG8CLq8Nj0cdg=; b=0HaU6Bm4hn73bt2ontVN0kYx0hxi+IKhGTZoKHAu1bw1eggFa1hJJCPCHoMnpSSGyL ZcPesI9Adey88epVwuYmdSx5ycQ0Xxr9/yiQa200ihxX4tJjRrnH2enr+8KW8u4zEiIQ XQWa3nGUBlszXqGyzTtI4aOY3dIdcu8ornivVpqCTQxOJwLFsIWFVKof+fPY8p4C3VdP FP/v2YPaJNu74e//Ddi7nu8BXB/ArcU549PvuIe2gfWFuDveGgwb+9ZGC9mtBKN4F+h7 c91v0sswwb4ypzxPPdFZuo4h1NM3a6dJS0PTi9I0nkTIAKkuuDnloDCIV4tYkvmdraWY f8Ag== X-Gm-Message-State: AOAM531S150D8RFCwjWcSdEWToa/h9/s05FtfqrC3a7Q1KTbRxocrGba hxCGzLISuRZWv8q6+gvFj6ltBdGO2w== X-Google-Smtp-Source: ABdhPJyTyueUhINu9g8C6j1nTaKQVAzX3dis7w5zq3wIgeOMEZmQ1LMr6HmD3/LwEP/suRaQxBY8og== X-Received: by 2002:a05:6214:5195:b0:464:507d:8eea with SMTP id kl21-20020a056214519500b00464507d8eeamr42134048qvb.91.1655078110891; Sun, 12 Jun 2022 16:55:10 -0700 (PDT) Original-Received: from darter (pool-108-30-23-113.nycmny.fios.verizon.net. [108.30.23.113]) by smtp.gmail.com with ESMTPSA id u16-20020a05620a455000b006a6ce613c7csm5559624qkp.89.2022.06.12.16.55.09 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jun 2022 16:55:09 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 11 Jun 2022 12:04:46 -0400") X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Mail-Followup-To: emacs-devel@gnu.org, Stefan Monnier Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=sam.steingold@gmail.com; helo=mail-qv1-xf2e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:291113 Archived-At: > * Stefan Monnier [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))