[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: |
Mon, 3 Jan 2022 03:31:41 +0000 |
> Sorry for I was making that conclusion based on
> the wrong assumption about how buffer local
> variables works.
>
> But I think instead of testing whether
> `lexical-binding' has been bound,
> (if (>= emacs-major-version 24)
> (provide 'lexical-binding))
My question has nothing to do with
`provide'ing a `lexical-binding' feature.
Adding such a feature is neither needed
nor helpful. (And with that name it
might even mislead.)
> testing major version number seems to be easier since
> it is unlikely someone would take an old version of
> Emacs and patch for lexical binding only, or use a
> version above 24 but taking out the lexical binding
> support.
Testing the Emacs version # is OK also,
of course. But that coding difference
too is irrelevant for my question/post.
It's not about that, at all.
And in general it's a bit better to test
for a variable or function definition
(`(f)boundp') than it is to test for an
Emacs version. For one thing, it lets
a reader of the code know specifically
what's needed from that version.
> And instead of doing the lexical binding support test
> in every file, having the `provide' statement in one
> file loaded before any other files and use `featurep'
> as a universal test of that feature seems to be more
> appropriate.
My question is specific to a single file.
It's even specific to particular parts of
a file.
> I apologize again for not reading your post carefully.
No problem. At least you tried to help.
Thx.
> However, as Stefan says, what lexical-binding provides
> is "nothing ground breaking", even you've already
> hit a critical performance bottle neck, converting
> to lexical binding would help little.
I'm well aware of what it has to offer. But thx.
> In my opinion, adopting lexical-binding is mainly
> for making the code cleaner. Having both lexical
> binding and dynamic binding in one library, seems
> to be contrary to that goal.
What I asked about and mentioned is not about
having lexical and dynamic binding in the same
library - that is, for the same Emacs version.
Variable `lexical-binding' is itself not about
having only lexical binding. It's simply about
Emacs support for lexical binding _in addition_
to dynamic binding (what Common Lisp has offered
since its outset).
Re: Conditional binding and testing of `lexical-binding', Stefan Monnier, 2022/01/02