all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: LdBeth <andpuke@foxmail.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Conditional binding and testing of `lexical-binding'
Date: Mon, 3 Jan 2022 03:31:41 +0000	[thread overview]
Message-ID: <SJ0PR10MB54888D0F633D1AD71D2B1F54F3499@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <tencent_B9F73F1CB7BD6E46C7D31E078C741D4CAB07@qq.com>

> 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).



  reply	other threads:[~2022-01-03  3:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-01 22:24 Conditional binding and testing of `lexical-binding' Drew Adams
2022-01-02 12:36 ` LdBeth
2022-01-02 12:41   ` Po Lu
2022-01-02 18:29     ` Stefan Monnier
2022-01-02 23:01       ` [External] : " Drew Adams
2022-01-02 23:01     ` Drew Adams
2022-01-03  0:49       ` Po Lu
2022-01-02 23:01   ` Drew Adams
2022-01-03  3:09     ` LdBeth
2022-01-03  3:31       ` Drew Adams [this message]
2022-01-02 18:27 ` Stefan Monnier
2022-01-02 23:01   ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54888D0F633D1AD71D2B1F54F3499@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=andpuke@foxmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.