From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook` Date: Sat, 24 Apr 2021 14:11:48 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="580"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, jakanakaevangeli@chiru.no To: 47992@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 24 14:12:11 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 1laH8t-000AcT-9U for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 14:12:11 +0200 Original-Received: from localhost ([::1]:33810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laH8s-0007id-9M for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 08:12:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laH8k-0007iP-F0 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 08:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56303) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laH8k-000298-7I for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 08:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1laH8k-0000tc-2i for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 08:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Apr 2021 12:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47992 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16192663193433 (code B ref -1); Sat, 24 Apr 2021 12:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Apr 2021 12:11:59 +0000 Original-Received: from localhost ([127.0.0.1]:39616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laH8h-0000tH-0u for submit@debbugs.gnu.org; Sat, 24 Apr 2021 08:11:59 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:35414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laH8f-0000tA-HP for submit@debbugs.gnu.org; Sat, 24 Apr 2021 08:11:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laH8f-0007gs-4G for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 08:11:57 -0400 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:41111 helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laH8c-00020V-2f for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 08:11:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date: Message-ID:Subject:From:Cc:To:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vi2/lmURMq45F6t0O6t22NUwcI+5eotmKnIFBw6ju8s=; b=RibPsbm7IzMnMZMdTt956wcf1Y 3OYVkmQqWYcnnFp94Wu5hValnOcxq6wwdYSSic33kJyNMeZf9bfSkywDbpTcUHrIiJ66PYv9KArWm gpQkqHxIM3MWcHKqhAdB0Emu3SsHLpSjlFfoCdmFebKhxqOZ3rJgeN/PhM57G9/B23bg=; Content-Language: en-US Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:204795 Archived-At: (Follow-up to bug#46326 as suggested by Stefan Monnier) The functions `add/remove-hook` make use of `equal` to test equality of hooks. Using `equal` can lead to excessive memory allocations (bug#46326) or hangups (see comment in `set-transient-map`), when large closures or cyclic closures are used as hooks. Right now there are at least three places which have to work around the use of `equal` in `add/remove-hook` using a symbol indirection: * `set-transient-map` * `minibuffer-with-setup-hook` * `eval-after-load` It would be good to change `add/remove-hook` such that it only relies on `eq` to test hook equality. Then the symbol indirection workarounds can be avoided. However making such a change directly can lead to subtle breakage. Perhaps one could introduce some deprecation behavior first, before making the final change to `eq`. If a hook is added/removed and the added/removed object is not found via `eq` but found via `equal`, show a deprecation warning?