GNU bug report logs - #66636
Move lexical-binding warning from checkdoc to byte-compiler

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Date: Thu, 19 Oct 2023 11:50:01 UTC

Severity: normal

Done: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66636 in the body.
You can then email your comments to 66636 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Thu, 19 Oct 2023 11:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mattias Engdegård <mattias.engdegard <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 19 Oct 2023 11:50:01 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Emacs Bug Report <bug-gnu-emacs <at> gnu.org>
Subject: Move lexical-binding warning from checkdoc to byte-compiler
Date: Thu, 19 Oct 2023 13:48:21 +0200
[Message part 1 (text/plain, inline)]
The warning about a missing lexical-binding cookie rather belongs in the compiler than checkdoc, because it's not about documentation or style but code generation and ability to detect errors, both which are hindered by a missing cookie.

Moving the warning to the compiler also makes it more widely seen.

[0001-Move-lexical-binding-warning-from-checkdoc-to-byte-c.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Thu, 19 Oct 2023 11:57:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Thu, 19 Oct 2023 14:55:02 +0300
> From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
> Date: Thu, 19 Oct 2023 13:48:21 +0200
> 
> The warning about a missing lexical-binding cookie rather belongs in the compiler than checkdoc, because it's not about documentation or style but code generation and ability to detect errors, both which are hindered by a missing cookie.
> 
> Moving the warning to the compiler also makes it more widely seen.

Adding Stefan, in case he has an opinion and/or comments.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Thu, 19 Oct 2023 14:14:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Thu, 19 Oct 2023 10:12:25 -0400
>> The warning about a missing lexical-binding cookie rather belongs in the
>> compiler than checkdoc, because it's not about documentation or style but
>> code generation and ability to detect errors, both which are hindered by
>> a missing cookie.
>>
>> Moving the warning to the compiler also makes it more widely seen.

I think it's a great idea.  I hadn't noticed this warning in checkdoc,
else I would have probably suggested the same.

The patch looks good too (and the resulting simplicity, to me, is a good
hint that it's a better place to put this warning).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Thu, 19 Oct 2023 17:42:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>, 
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Thu, 19 Oct 2023 10:40:31 -0700
Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:

> The warning about a missing lexical-binding cookie rather belongs in
> the compiler than checkdoc, because it's not about documentation or
> style but code generation and ability to detect errors, both which are
> hindered by a missing cookie.
>
> Moving the warning to the compiler also makes it more widely seen.

Yes, that makes much more sense.  Thanks for doing that.

The patch looks good too.

> +    ;;; My little pony mode  -*- lexical-binding: t -*-

If we want this to conform with the format required by package.el, this
should be:

;;; pony.el --- My little pony mode  -*- lexical-binding: t -*-

Or would that distract from the main point?

> +Lexical binding avoids some name conflicts and allows the compiler
> +to detect more mistakes and generate more efficient code.

On a side note, it would be good to also highlight this in the relevant
sections of the manual.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 06:11:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 14:09:45 +0800
Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:

> The warning about a missing lexical-binding cookie rather belongs in
> the compiler than checkdoc, because it's not about documentation or
> style but code generation and ability to detect errors, both which are
> hindered by a missing cookie.
>
> Moving the warning to the compiler also makes it more widely seen.

So long as this warning is only displayed within code part of Emacs
itself, there are no valid objections to such a change.

But you have instead elected to generate warnings whenever such files
are byte-compiled.  There exist many packages which do not enable
lexical binding, whose authors have studiously elected not to: most of
Drew Adams' for example.  So this is tantamount to punitive action
against their users, in the form of an unsightly warning each time such
packages are installed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 07:03:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: mattias.engdegard <at> gmail.com, 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 10:01:44 +0300
> Cc: 66636 <at> debbugs.gnu.org
> Date: Fri, 20 Oct 2023 14:09:45 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:
> 
> > The warning about a missing lexical-binding cookie rather belongs in
> > the compiler than checkdoc, because it's not about documentation or
> > style but code generation and ability to detect errors, both which are
> > hindered by a missing cookie.
> >
> > Moving the warning to the compiler also makes it more widely seen.
> 
> So long as this warning is only displayed within code part of Emacs
> itself, there are no valid objections to such a change.
> 
> But you have instead elected to generate warnings whenever such files
> are byte-compiled.  There exist many packages which do not enable
> lexical binding, whose authors have studiously elected not to: most of
> Drew Adams' for example.  So this is tantamount to punitive action
> against their users, in the form of an unsightly warning each time such
> packages are installed.

Cannot such packages disable this warning in file-local variables?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 07:15:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mattias.engdegard <at> gmail.com, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 15:13:15 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 66636 <at> debbugs.gnu.org
>> Date: Fri, 20 Oct 2023 14:09:45 +0800
>> From:  Po Lu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:
>> 
>> > The warning about a missing lexical-binding cookie rather belongs in
>> > the compiler than checkdoc, because it's not about documentation or
>> > style but code generation and ability to detect errors, both which are
>> > hindered by a missing cookie.
>> >
>> > Moving the warning to the compiler also makes it more widely seen.
>> 
>> So long as this warning is only displayed within code part of Emacs
>> itself, there are no valid objections to such a change.
>> 
>> But you have instead elected to generate warnings whenever such files
>> are byte-compiled.  There exist many packages which do not enable
>> lexical binding, whose authors have studiously elected not to: most of
>> Drew Adams' for example.  So this is tantamount to punitive action
>> against their users, in the form of an unsightly warning each time such
>> packages are installed.
>
> Cannot such packages disable this warning in file-local variables?

I don't think so, at least insomuch as byte-compile-warnings doesn't
function as a file-local variable.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 07:23:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: mattias.engdegard <at> gmail.com, monnier <at> iro.umontreal.ca,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 10:21:32 +0300
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,  mattias.engdegard <at> gmail.com,
>   66636 <at> debbugs.gnu.org
> Date: Fri, 20 Oct 2023 15:13:15 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Cc: 66636 <at> debbugs.gnu.org
> >> Date: Fri, 20 Oct 2023 14:09:45 +0800
> >> From:  Po Lu via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >> 
> >> Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:
> >> 
> >> > The warning about a missing lexical-binding cookie rather belongs in
> >> > the compiler than checkdoc, because it's not about documentation or
> >> > style but code generation and ability to detect errors, both which are
> >> > hindered by a missing cookie.
> >> >
> >> > Moving the warning to the compiler also makes it more widely seen.
> >> 
> >> So long as this warning is only displayed within code part of Emacs
> >> itself, there are no valid objections to such a change.
> >> 
> >> But you have instead elected to generate warnings whenever such files
> >> are byte-compiled.  There exist many packages which do not enable
> >> lexical binding, whose authors have studiously elected not to: most of
> >> Drew Adams' for example.  So this is tantamount to punitive action
> >> against their users, in the form of an unsightly warning each time such
> >> packages are installed.
> >
> > Cannot such packages disable this warning in file-local variables?
> 
> I don't think so, at least insomuch as byte-compile-warnings doesn't
> function as a file-local variable.

Then maybe we should allow that for this new warning (and potentially
also other warnings).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 10:16:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 12:15:18 +0200
19 okt. 2023 kl. 19.40 skrev Stefan Kangas <stefankangas <at> gmail.com>:

>> +    ;;; My little pony mode  -*- lexical-binding: t -*-
> 
> If we want this to conform with the format required by package.el, this
> should be:
> 
> ;;; pony.el --- My little pony mode  -*- lexical-binding: t -*-
> 
> Or would that distract from the main point?

Indeed the example was chosen to avoid anything irrelevant. If anything should go it would be the pony, but I put it there to remind the user that it's fine to include something else that obviously isn't parsed.
Something too formal-looking might give the impression of compulsory and/or machine-readable structure.

(I always found this traditional first line to be somewhat of an uneasy composite: too often it forces unnatural brevity on the description, or becomes so long that it wraps. I'd favour dedicating the first line to the -*- cookie alone.)

> On a side note, it would be good to also highlight this in the relevant
> sections of the manual.

Yes, the manual needs updating in some respects. I'll do this separately to keep the text as coherent as possible.

Thank you for the kind review!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 13:40:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 09:38:33 -0400
>> The warning about a missing lexical-binding cookie rather belongs in
>> the compiler than checkdoc, because it's not about documentation or
>> style but code generation and ability to detect errors, both which are
>> hindered by a missing cookie.
>>
>> Moving the warning to the compiler also makes it more widely seen.
>
> So long as this warning is only displayed within code part of Emacs
> itself, there are no valid objections to such a change.
>
> But you have instead elected to generate warnings whenever such files
> are byte-compiled.  There exist many packages which do not enable
> lexical binding, whose authors have studiously elected not to: most of
> Drew Adams' for example.  So this is tantamount to punitive action
> against their users, in the form of an unsightly warning each time such
> packages are installed.

No, it's just asking those authors to make the result of their studious
work explicit with

    -*- lexical-binding: nil -*-


-- Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 16:29:01 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Po Lu <luangruo <at> yahoo.com>, Mattias Engdegård
 <mattias.engdegard <at> gmail.com>
Cc: "66636 <at> debbugs.gnu.org" <66636 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#66636: Move lexical-binding warning from
 checkdoc to byte-compiler
Date: Fri, 20 Oct 2023 16:27:48 +0000
> There exist many packages which do not enable
> lexical binding, whose authors have studiously
> elected not to: most of Drew Adams' for example.

Only because they are old or intended to
support also old Emacs releases.

I'm on record from Day One as _favoring_
the approach of Common Lisp (and now
Elisp) of lexical binding by default and
dynamic binding for variable declared as
special.

> So this is tantamount to punitive action
> against their users, in the form of an
> unsightly warning each time such
> packages are installed.

I can't speak for anyone else, obviously,
but for my part such warnings don't
particularly bother me for my libraries.

On the other hand, it's not clear to me
why we would have warnings other than for
byte-compiling.  (I just haven't been
following this - there might be a good
reason; dunno.)

The one thing that does bother me about
the change to what I prefer (lexical by
default) is the outright _removal_ of
`lexical-let[*]'.  This is really a
bother.  Code can be complex, and for a
library that has several uses of this
macro it's not necessarily simple to
modify it to use only (lexical) `let[*]'.

IMHO, it should have been (still should
be) possible to keep support for
`lexical-let[*]' around for much longer
- maybe forever.  It should be enough
to tell users not to use it for new code,
and why.
___

In _general_, I'm not crazy about Emacs
removing things, no matter how old or
deprecated.  If their code path isn't
used it should be no bother, especially
if it's relatively separate from other
code paths.

Deprecation alone generally means (1)
the thing is still supported but (2)
it's not enhanced.  And it would be
tolerable if deprecation even meant no
bug fixes.

An overeager-beaver impetus to _remove_
features is generally misguided, IMO.
But yeah, I'm not maintaining Emacs, so
this is easy for me to say.  (Just one
opinion.)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 17:41:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Po Lu <luangruo <at> yahoo.com>, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Kangas <stefankangas <at> gmail.com>, 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 19:40:02 +0200
20 okt. 2023 kl. 15.38 skrev Stefan Monnier <monnier <at> iro.umontreal.ca>:

> No, it's just asking those authors to make the result of their studious
> work explicit with
> 
>    -*- lexical-binding: nil -*-

Right, and our sympathies are not so much for people dead set on writing new dynbound code as for users saddled with dusty decks.

Looks like there are no serious objections so the changes will be pushed soon, probably some time tomorrow.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 19:29:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: luangruo <at> yahoo.com, monnier <at> iro.umontreal.ca, 66636 <at> debbugs.gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 22:27:32 +0300
> From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
> Date: Fri, 20 Oct 2023 19:40:02 +0200
> Cc: Po Lu <luangruo <at> yahoo.com>,
>  66636 <at> debbugs.gnu.org,
>  Stefan Kangas <stefankangas <at> gmail.com>,
>  Eli Zaretskii <eliz <at> gnu.org>
> 
> Looks like there are no serious objections so the changes will be pushed soon, probably some time tomorrow.

Really?  Is that what you deduced from the messages posted about this
change?  Did you see what Po Lu and I said?  What is your response to
that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 19:46:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Po Lu <luangruo <at> yahoo.com>
Cc: mattias.engdegard <at> gmail.com, monnier <at> iro.umontreal.ca,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 12:44:21 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

>> I don't think so, at least insomuch as byte-compile-warnings doesn't
>> function as a file-local variable.
>
> Then maybe we should allow that for this new warning (and potentially
> also other warnings).

If adding file local variables is an acceptable work-around, then adding
this to the .el file should be acceptable too:

    ;;; -*- lexical-binding:nil -*-

And that already works with the proposed patch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Fri, 20 Oct 2023 20:57:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Fri, 20 Oct 2023 13:55:27 -0700
Mattias Engdegård <mattias.engdegard <at> gmail.com> writes:

> (I always found this traditional first line to be somewhat of an
> uneasy composite: too often it forces unnatural brevity on the
> description, or becomes so long that it wraps. I'd favour dedicating
> the first line to the -*- cookie alone.)

I mostly agree, but removing the traditional file name is another
reasonable way to make the line a bit less unwieldy.  I'd be even more
inclined to make a change like that, myself.

Going on a tangent here, but I always assumed that the file name on the
first line was there for hysterical raisins, going back to the good old
days when people had to resort to sharing ELisp hacks on Usenet.  These
days, with GNU ELPA and git repositories, there is no risk for any
confusion about the name of a file.

I might be wrong though.  Perhaps it was always redundant?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sat, 21 Oct 2023 09:55:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, monnier <at> iro.umontreal.ca, 66636 <at> debbugs.gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sat, 21 Oct 2023 11:53:58 +0200
20 okt. 2023 kl. 21.27 skrev Eli Zaretskii <eliz <at> gnu.org>:

> Did you see what Po Lu and I said?

Not sure what he was trying to say, but it looks like a misunderstanding.
I'll try to clarify matters here. Please tell me if you still have concerns.

We certainly care about users of legacy code. The warning is intended as a soft nudge to encourage users to convert their code to lexical binding, which is quite straightforward most of the time.

When it's not, or when the user simply doesn't have the time or expertise to perform the conversion, it's just a matter of inserting `-*- lexical-binding: nil -*-`. Doing so will both silence the warning and buy the user some reprieve. A lot of reprieve, in fact.

This should probably be pointed out in the NEWS entry as well.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sat, 21 Oct 2023 11:19:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: luangruo <at> yahoo.com, monnier <at> iro.umontreal.ca, 66636 <at> debbugs.gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sat, 21 Oct 2023 14:17:45 +0300
> From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
> Date: Sat, 21 Oct 2023 11:53:58 +0200
> Cc: monnier <at> iro.umontreal.ca,
>  luangruo <at> yahoo.com,
>  66636 <at> debbugs.gnu.org,
>  stefankangas <at> gmail.com
> 
> We certainly care about users of legacy code. The warning is intended as a soft nudge to encourage users to convert their code to lexical binding, which is quite straightforward most of the time.
> 
> When it's not, or when the user simply doesn't have the time or expertise to perform the conversion, it's just a matter of inserting `-*- lexical-binding: nil -*-`. Doing so will both silence the warning and buy the user some reprieve. A lot of reprieve, in fact.
> 
> This should probably be pointed out in the NEWS entry as well.

If specifying lexical-binding:nil in the first line is the solution
for those who want to keep dynamically-bound code, then yes, it should
be definitely in NEWS, and probably also in the ELisp manual.




Reply sent to Mattias Engdegård <mattias.engdegard <at> gmail.com>:
You have taken responsibility. (Sat, 21 Oct 2023 13:19:02 GMT) Full text and rfc822 format available.

Notification sent to Mattias Engdegård <mattias.engdegard <at> gmail.com>:
bug acknowledged by developer. (Sat, 21 Oct 2023 13:19:02 GMT) Full text and rfc822 format available.

Message #58 received at 66636-done <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 66636-done <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sat, 21 Oct 2023 15:17:22 +0200
21 okt. 2023 kl. 13.17 skrev Eli Zaretskii <eliz <at> gnu.org>:

> If specifying lexical-binding:nil in the first line is the solution
> for those who want to keep dynamically-bound code, then yes, it should
> be definitely in NEWS, and probably also in the ELisp manual.

Agreed on both points. The patch has been pushed with that change to NEWS, and Elisp manual revisions are upcoming.  We are a bit behind on lexical-binding in the manual so it could do with some more work.

Thanks to everyone who commented!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sat, 21 Oct 2023 14:44:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Mattias Engdegård
 <mattias.engdegard <at> gmail.com>
Cc: "luangruo <at> yahoo.com" <luangruo <at> yahoo.com>,
 "monnier <at> iro.umontreal.ca" <monnier <at> iro.umontreal.ca>,
 "66636 <at> debbugs.gnu.org" <66636 <at> debbugs.gnu.org>,
 "stefankangas <at> gmail.com" <stefankangas <at> gmail.com>
Subject: RE: [External] : bug#66636: Move lexical-binding warning from
 checkdoc to byte-compiler
Date: Sat, 21 Oct 2023 14:42:56 +0000
> If specifying lexical-binding:nil in the first line is the solution
> for those who want to keep dynamically-bound code, then yes, it should
> be definitely in NEWS, and probably also in the ELisp manual.

Yes, it should be documented, but not just as
a simple solution, because it's not.

FWIW: It's not a solution for code that uses
`lexical-let[*]'.  That's simply been removed
now from Emacs, unfortunately.  It's not as
simple as just setting `lexical-binding' to nil
and replacing occurrences of `lexical-binding'
with `let[*]'.

And it's not even simple to try to include the
macros for `lexical-let[*]' in your code as a
temporary stop-gap.  Ditching `lexical-let[*]'
can really break things.  Just saying...

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sat, 21 Oct 2023 15:46:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com,
 Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 stefankangas <at> gmail.com, 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sat, 21 Oct 2023 11:44:55 -0400
> If specifying lexical-binding:nil in the first line is the solution
> for those who want to keep dynamically-bound code, then yes, it should
> be definitely in NEWS, and probably also in the ELisp manual.

FWIW, I think this would be a disservice to them (and to ourselves).
In 99% of the cases it's just as easy to make the code work with
`lexical-binding:t`.

We do want to allow people to silence the warning with
`lexical-binding:nil`, but we don't want to encourage it.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sat, 21 Oct 2023 16:10:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: luangruo <at> yahoo.com, mattias.engdegard <at> gmail.com, stefankangas <at> gmail.com,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sat, 21 Oct 2023 19:08:28 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Mattias Engdegård <mattias.engdegard <at> gmail.com>,
>   luangruo <at> yahoo.com,
>   66636 <at> debbugs.gnu.org,  stefankangas <at> gmail.com
> Date: Sat, 21 Oct 2023 11:44:55 -0400
> 
> > If specifying lexical-binding:nil in the first line is the solution
> > for those who want to keep dynamically-bound code, then yes, it should
> > be definitely in NEWS, and probably also in the ELisp manual.
> 
> FWIW, I think this would be a disservice to them (and to ourselves).

What will?

> We do want to allow people to silence the warning with
> `lexical-binding:nil`, but we don't want to encourage it.

NEWS is not about encouraging anything, it is about fire escape.  The
manual encourages (or discourages) certain practices, but NEWS is
about something else.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sun, 22 Oct 2023 00:17:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 66636 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sun, 22 Oct 2023 08:15:38 +0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> FWIW, I think this would be a disservice to them (and to ourselves).
> In 99% of the cases it's just as easy to make the code work with
> `lexical-binding:t`.

I think we want to encourage whatever relieves users of the most work,
not what comports best with some abstract conception of desirability.

Since the number of package developers does not exceed the number of
users installing packages, which goes without saying.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sun, 22 Oct 2023 04:14:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 Mattias Engdegård <mattias.engdegard <at> gmail.com>,
 66636 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sun, 22 Oct 2023 00:12:51 -0400
>> FWIW, I think this would be a disservice to them (and to ourselves).
>> In 99% of the cases it's just as easy to make the code work with
>> `lexical-binding:t`.
> I think we want to encourage whatever relieves users of the most work,
> not what comports best with some abstract conception of desirability.

For users it should make no difference, they don't need to do anything
(other than avert their eyes from the warning, maybe).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sun, 22 Oct 2023 05:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: luangruo <at> yahoo.com, mattias.engdegard <at> gmail.com, stefankangas <at> gmail.com,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sun, 22 Oct 2023 08:16:04 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  Mattias Engdegård
>  <mattias.engdegard <at> gmail.com>,  66636 <at> debbugs.gnu.org,
>   stefankangas <at> gmail.com
> Date: Sun, 22 Oct 2023 00:12:51 -0400
> 
> >> FWIW, I think this would be a disservice to them (and to ourselves).
> >> In 99% of the cases it's just as easy to make the code work with
> >> `lexical-binding:t`.
> > I think we want to encourage whatever relieves users of the most work,
> > not what comports best with some abstract conception of desirability.
> 
> For users it should make no difference, they don't need to do anything
> (other than avert their eyes from the warning, maybe).

You interpret "users" in what I wrote too narrowly, I think.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66636; Package emacs. (Sun, 22 Oct 2023 05:30:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, mattias.engdegard <at> gmail.com, stefankangas <at> gmail.com,
 66636 <at> debbugs.gnu.org
Subject: Re: bug#66636: Move lexical-binding warning from checkdoc to
 byte-compiler
Date: Sun, 22 Oct 2023 01:28:44 -0400
>> >> FWIW, I think this would be a disservice to them (and to ourselves).
>> >> In 99% of the cases it's just as easy to make the code work with
>> >> `lexical-binding:t`.
>> > I think we want to encourage whatever relieves users of the most work,
>> > not what comports best with some abstract conception of desirability.
>> 
>> For users it should make no difference, they don't need to do anything
>> (other than avert their eyes from the warning, maybe).
>
> You interpret "users" in what I wrote too narrowly, I think.

My reply is to Po Lu who seemed to use "users" in the sense of "non
developers" (indeed, this use surprised me as well).


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 271 days ago.

Previous Next


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