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: [External] : bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook` Date: Sat, 24 Apr 2021 22:23:50 +0200 Message-ID: <95dee1b3-10c4-24fb-e483-ec3f36bdf5f0@daniel-mendler.de> References: 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="5232"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "monnier@iro.umontreal.ca" , "jakanakaevangeli@chiru.no" To: Drew Adams , "47992@debbugs.gnu.org" <47992@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 24 22:25:12 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 1laOpz-0001Ei-Uw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 22:25:11 +0200 Original-Received: from localhost ([::1]:38896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laOpz-0006xF-2u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 16:25:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laOpq-0006x7-S7 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 16:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58257) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laOpq-0003nI-K2 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 16:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1laOpq-0006yG-4j for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 16:25: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 20:25: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.161929584326715 (code B ref 47992); Sat, 24 Apr 2021 20:25:02 +0000 Original-Received: (at 47992) by debbugs.gnu.org; 24 Apr 2021 20:24:03 +0000 Original-Received: from localhost ([127.0.0.1]:41570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laOot-0006wp-2c for submit@debbugs.gnu.org; Sat, 24 Apr 2021 16:24:03 -0400 Original-Received: from server.qxqx.de ([178.63.65.180]:50009 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laOop-0006wJ-Ak for 47992@debbugs.gnu.org; Sat, 24 Apr 2021 16:24:01 -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:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ea3mu9IQQYWT3O6ArS499MO/1Rl+tsDwn7E7tq1j2BE=; b=QqMPJzQDN+29ZvWLk4/q2vUJgo uVvNZn73BKVGY2ICBYa1bOFJRLv+kDDDds6pdc73masPWUIpaUmqofviLfYguPWIyWX5XbpVM7/dx c7bkiw/Dmv99ojsVE5C8j/y5dSjfIZJTc2d/ISctsz2A67xrexz4FF4RGohe4mSjJD/U=; In-Reply-To: Content-Language: en-US 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:204823 Archived-At: On 4/24/21 10:12 PM, Drew Adams wrote: > So instead of just advising users not to use lambda forms > (which makes sense), you'd make it no longer work at all > for interpreted lambda forms (except rare cases where > they might actually be `eq' - e.g., same list structure)? I agree that it makes sense to use symbols in case you want to add a plain function as hook. However often you want to add closures; `minibuffer-with-setup-hook`, `set-transient-map` and `eval-after-load` are examples where this happens. In order to improve the support for closures as hooks, this change is necessary. It is not reasonable to require every `add-hook` user, who wants to add a closure, to introduce a symbol indirection. This is neither obvious nor easy. Even a very commonly used macro like `minibuffer-with-setup-hook` got this wrong. Furthermore I would argue there are no plausible scenarios where you want to add a closure or lambda as hook and then remove or add it again afterwards, but not using the identical object, but only an object which is `equal`. This is more than enough motivation for a change to `eq`. Daniel