From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#47992: [External] : bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook` Date: Sat, 24 Apr 2021 19:04:02 -0400 Message-ID: References: <090f8bd5-368c-5684-85e1-65420049d47a@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31812"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "47992@debbugs.gnu.org" <47992@debbugs.gnu.org>, "jakanakaevangeli@chiru.no" To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 25 01:05:15 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1laRKt-0007z7-0b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Apr 2021 01:05:15 +0200 Original-Received: from localhost ([::1]:55340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laRKr-0003bv-ID for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 19:05:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laRKj-0003bh-N0 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 19:05:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laRKg-0007oc-Hk for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 19:05:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1laRKg-0004T8-Cn for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 19:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Apr 2021 23:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47992 X-GNU-PR-Package: emacs Original-Received: via spool by 47992-submit@debbugs.gnu.org id=B47992.161930545417115 (code B ref 47992); Sat, 24 Apr 2021 23:05:02 +0000 Original-Received: (at 47992) by debbugs.gnu.org; 24 Apr 2021 23:04:14 +0000 Original-Received: from localhost ([127.0.0.1]:41673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laRJt-0004Ry-RV for submit@debbugs.gnu.org; Sat, 24 Apr 2021 19:04:14 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laRJr-0004Rl-6y for 47992@debbugs.gnu.org; Sat, 24 Apr 2021 19:04:12 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A459A100311; Sat, 24 Apr 2021 19:04:05 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3D9FB10001F; Sat, 24 Apr 2021 19:04:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1619305444; bh=hEPw85JIE9VgmbPtFRVweB53f7eyzO2ZqCtiVnVe7w0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Y9EU5AphPdwDxlyMbmb9nRQzGGRuexA/eoVGTFI2hF2lqQGgpCmMreqsCLcwYp8Mb 3n29mnxCvxoIm0xRHSNiHtim15a0EHDcBOyYrpC9ZAUYTdMws299wBSG7OVtATIk+a HaD6W8qaWDkB3EvIXkr1MoejcchOF0L1qSrvEzePLSkukGUMtd0u/cl95LeiC2HRtO 6C/rY4KYU5Qt6EAofZ1rCw+6i0PXFd08VZnDkCZz+OBI2pPUpno3PXGv2ad6VX7Ou4 2hX/ekmiTULoVF6mR9XHj8Zkre2Kxa/vCot957fV7gMJFAMLMSZmUBAhA5FPF3cxtg a+8Y4HHyvn7qw== Original-Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 010AE1202C2; Sat, 24 Apr 2021 19:04:03 -0400 (EDT) In-Reply-To: <090f8bd5-368c-5684-85e1-65420049d47a@daniel-mendler.de> (Daniel Mendler's message of "Sun, 25 Apr 2021 00:38:25 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204831 Archived-At: >>> Perhaps `equal' can be fixed to do something better with closures? >> There's no magic: `equal` has to check the structural equality, so it >> has to recurse through the whole structure, including all the >> closed-over variables to which it refers. > Well, structural equality on closures is an arbitrary choice. One could > simply refuse to compare closures structurally and treat them as opaque > objects. Currently we could do that for byte-compiled closures but not for interpreted ones. > The structural equality does not even perform alpha conversion. It partly does actually, by accident, when the code is byte-compiled, but only for the variables internal to the function and not for the formal arguments (because they "escape" into the docstring). Hopefully this will be "broken" at some point, when we add enough debug info to bytecode to be able to find the value of (and set) local variables by name. > This is probably due to how binding works in Elisp? > > (equal (lambda (x) x) (lambda (y) y)) Equality on functions is fundamentally undecidable and it's nigh-on impossible to provide a sane and well-defined "approximation" of it either (at least not without significantly restricting the set of optimizations that the compiler can be allowed to perform). The upside is that this fundamental problem was the motivation for the development of type classes in Haskell which are a great feature (nowadays used in most proof assistants and in several other programming languages such as Scala and Rust). Stefan