On Thu, 19 Nov 2020 at 14:51, Stefan Kangas <stefan@marxist.se> wrote:
Neil Jerram <neiljerram@gmail.com> writes:

>> I've been working on removing redundant `function' around `lambda' in
>> Emacs core,
>
> I'm slightly curious about the history and reasoning around this.  If I
> understand correctly, (lambda ...) on its own has always worked, and it's
> never been strictly necessary to add (quote ...) or (function ...) around
> it.  Then sometime (Emacs 19 or later, I think) it started being
> recommended to use (function ...).
>
> Do you know why that recommendation started, and should I understand that
> the reasoning for it has now evaporated?

Correct, there is no reason to do this.

I don't know the history here, and there are people on emacs-devel that
would know better.

I _suspect_ that the byte-compiler first got the capability to optimize
calls to anonymous functions, but that it required to explicitly marked
as such with `function'.  Later, it grew the capability to recognize
lambda as such automatically.  But I don't know if that is correct; it's
just a guess.  In any case, they are no longer needed as lambda and
lambda+function are equivalent.

(Note that the worst thing here is to do `(quote (lambda ...))' as that
defeats byte-compiler optimizations altogether.)

Many thanks Stefan!