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
(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?
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.