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: Drew Adams
Subject: bug#47992: [External] : bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`
Date: Sun, 25 Apr 2021 01:23:03 +0000

> > 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)?
> 
> It would still work for lambda forms, just differently (arguably,
> in a way that's more often right than the current way).

Please elaborate.  Comparing lambda forms using `eq'?
Not clear to me how that works in the general case.

 (eq (lambda () foo) (lambda () foo)) ?

I don't see that it works at all, let alone works more
often than the current way:
 (equal (lambda () foo) (lambda () foo))

> > Perhaps `equal' can be fixed to do something better with closures?
> 
> There's no magic: `equal` has to check the structural equality, so it
> has to recurse through the whole structure, including all the
> closed-over variables to which it refers.

That's what I was hinting.  I don't see the magic either.

> > E.g., if the `eq' test in `equal' fails for a
> > closure arg then return nil?  (I'm not proposing that.)
> 
> That's what using `eq` would do, so you seem to agree with
> Daniel's proposal here.

Not at all.  I was saying that that's what I understand
him to be proposing, in the context of `add-hook'.

If that made sense for that case (which it doesn't, to
me) then I should think it would make sense in general
(which I don't think it does - no such magic).

How does comparing closures with `eq' makes sense for
`add-hook' but not in general?  That was the question.
I don't see that it makes sense for either.





reply via email to

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