GNU bug report logs -
#47992
27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`
Previous Next
Reported by: Daniel Mendler <mail <at> daniel-mendler.de>
Date: Sat, 24 Apr 2021 12:12:01 UTC
Severity: normal
Tags: fixed
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> In order to improve the support for closures as hooks,
> this change is necessary.
Necessary? Why? There's no other way to do that?
> It is not reasonable to require every `add-hook` user,
> who wants to add a closure, to introduce a symbol
> indirection.
Why not? "Symbol indirection" just means setting a
symbol's `symbol-function' to the closure, then using
the symbol. Why is doing that a big deal?
It's what anyone should do when using `add|remove-hook',
at least interpreted, and interactively.
I ask again: If closure equality is inherently a
problem, why limit the "solution" to `add|remove-hook'?
Shouldn't your argument be that closure equality should
_always_ be tested (testable) using just `eq'? Is this
really about `add|remove-hook'? Why would they be
special in this regard?
> 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`.
M-: (add-hook 'foo-hook (lambda () (whatever)))
Of course that's generally not advisable, because if
you then want to remove it interactively you'll have
to provide a lambda that's `equal' (with `M-: M-p',
for example). But it's common enough, I think.
It's better, e.g., to defun or fset the lambda form,
and then use the symbol. But I'm guessing that many
users don't always bother, and they're just careful
to respect `equal' (or they soon learn to be).
Emacs's use of Lisp is also interactive, and often ad
hoc. If we lose sight of that we lose sight of Emacs.
> This is more than enough motivation for a change to `eq`.
It's your motivation; understood. Thx.
This bug report was last modified 3 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.