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, 4 Jul 2021 17:08:00 +0000

> > But what advantage would these offer,
> > compared to standard naming?
> 
> By "standard naming" you mean "define a function,
> and then use it in `add-hook'?"  Experience shows
> that people avoid doing so (for various reason),
> so creating a new form to cater to this use case
> makes sense.

FWIW, I disagree.  There's no real need for such
a "new form".

I think the use case you've imagined for it is a
s t r e t c h .  Users will just as likely avoid
making any of your new forms as they avoid named
functions now.

The "various reasons" amount to laziness (which
is often the right approach), and that will be
the same reason for not naming lambdas in the
new way you envision.  There's a reason lambdas
are anonymous functions.

Here's maybe another hint that it isn't needed:
Has anyone ever requested such a feature?

And if there really were such a need, you could
just check for non-nil `eq'uality of a lambda's
doc string, instead of adding yet another "new
form" that will likely ~never be used.

And even that feature - using a doc string with
a lambda - is rarely used.  As the doc string
of `lambda' itself says:

   But documentation strings are usually not
   useful in nameless functions.

Let's not add another ~useless "new form" for
lambdas.  They already have a doc string, which
I'm guessing is as much a name as what you have
in mind.

If you really want to test with `eq', just use
`eq' together with function `documentation'.

That'll save you implementing the same kind of
thing for yet another "name".  Same test: (1)
are both "names" present (non-nil), and (2) if
if so, are they `eq'?

And the same problem will persist: few will
ever bother to provide such a "name", even if
it might help them with `add|remove-hook'.

You have a solution in search of a problem, I
think.  Users just learn the hard way (but the
doc of `add|remove-hook' could be improved to
help them learn) that they don't want to use
lambdas as hook functions.





reply via email to

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