Subject: RE: [External] : bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`

From: Drew Adams <[email-masked]>
Date: Sat, 24 Apr 2021 21:20:08 +0000

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