GNU bug report logs - #30078
27.0.50; Use lexical-binding for M-:

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Date: Thu, 11 Jan 2018 16:38:01 UTC

Severity: wishlist

Found in version 27.0.50

Fixed in version 27.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #56 received at 30078 <at> debbugs.gnu.org (full text, mbox):

From: Luis Gerhorst <privat <at> luisgerhorst.de>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, monnier <at> IRO.UMontreal.CA,
 30078 <at> debbugs.gnu.org
Subject: Re: bug#30078: 27.0.50; Use lexical-binding for M-:
Date: Sat, 13 Jan 2018 18:50:36 +0100
> On 12. Jan 2018, at 22:11, Michael Heerdegen <michael_heerdegen <at> web.de> wrote:
> 
> Ah, so you doubt that lexical-binding once should just be the default.
> Then I think we should discuss about this goal.

Here are a few possible pros of lexical binding:

1) Make Elisp more approachable to newcomers. Lexical binding is the default in most programming languages and thus more people are familiar with it. This makes it easier for people to understand existing code since they don‘t have to get used to implicit dynamic binding first, which the code may take advantage of.

2) Make existing code more maintainable. I was involved in porting the package emacs-eclim to lexical binding. The process shed light on some very dark parts of the codebase nobody had touched in a while since they were written in very bad style and thus hard to understand. Using lexical binding forced us to simplify those parts.

3) This is a minor one: I‘ve heard that lexical binding allows for more optimizations. I don‘t know to which extend this actually happens and whether it is noticeable to the user.

I believe 1) and 2) will significantly help improving the general quality of Elisp code and thus of Emacs in general.

Here‘s the big con:

If lexical binding should become the default one day, you would have to give everyone a reasonable amount of time (multiple years?) to adapt for it and port their code or set lexical binding to nil in their files.

One idea would be to make elisp-mode somehow encourage users to enable lexical binding in the files they are editing. Any ideas how this can be done without annoying users? Ideas:
- Prompting every time elisp-mode is enabled in a file that does not have a lexical binding header.
- I know that certain functions insert a apropriate copyright notice into el-files, do / can those also set lexical binding to t?

Best regards,
Luis




This bug report was last modified 6 years and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.