[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Conditional binding and testing of `lexical-binding
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Conditional binding and testing of `lexical-binding' |
Date: |
Sun, 2 Jan 2022 23:01:25 +0000 |
> > OTOH, I don't think there's much to be gained by using lexical binding
> > at all in code that's supposed to be compatible with versions of Emacs
> > without lexical binding.
>
> You get better byte-compiler warnings, and the native code generated
> from it is of higher quality, so it's likely to be marginally faster in
> such a build.
Yes, I suggested that (but I said byte-compile,
not native-compile). But of course that's only
when you compile with Emacs 24+.
It's the difference between Emacs knowing that
the value is a function versus it only being
able to know for sure that it's a list with a
`lambda' car. When a compiler knows that it's
a function it can sometimes take advantage of
that - beyond just providing better warnings.
> Nothing ground breaking, admittedly.
Yes, I said that too. Besides immediate minor
advantages, it presents the advantage of being
the code to use if/when the library later drops
compatibility with Emacs 23 and prior - that's
the part to keep, then.
Re: Conditional binding and testing of `lexical-binding', Stefan Monnier, 2022/01/02