bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#47992: [External] : bug#47992: 27; 28; Phase out use of `equal` in `


From: Daniel Mendler
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

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





reply via email to

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