GNU bug report logs -
#60758
29.0.60; while-let uses if-let* convention in contradiction to the docstring
Previous Next
Reported by: Daniel Mendler <mail <at> daniel-mendler.de>
Date: Thu, 12 Jan 2023 19:23:01 UTC
Severity: normal
Found in version 29.0.60
Done: Sean Whitton <spwhitton <at> spwhitton.name>
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 60758 in the body.
You can then email your comments to 60758 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Thu, 12 Jan 2023 19:23:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 12 Jan 2023 19:23:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The docstring of `while-let' says:
The variable list SPEC is the same as in if-let.
However in the definition `if-let*' is used. `if-let*' differs from
`if-let' since it doesn't support the special single binding form.
(while-let (var exp)
...)
Therefore `if-let*' should be replaced with `if-let' in the definition
of `while-let', bringing the implementation in accordance with the
docstring. The name `while-let' (in contrast to `while-let*') also
suggest that the `if-let' spec is supported.
In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw scroll bars) of 2022-12-30 built on projects
Repository revision: d086cd6cf877c6ca7af6712f9b79b52dd0caa934
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)
Reply sent
to
Sean Whitton <spwhitton <at> spwhitton.name>
:
You have taken responsibility.
(Fri, 13 Jan 2023 00:38:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
bug acknowledged by developer.
(Fri, 13 Jan 2023 00:38:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 60758-done <at> debbugs.gnu.org (full text, mbox):
Hello,
On Thu 12 Jan 2023 at 08:21PM +01, Daniel Mendler wrote:
> The docstring of `while-let' says:
>
> The variable list SPEC is the same as in if-let.
>
> However in the definition `if-let*' is used. `if-let*' differs from
> `if-let' since it doesn't support the special single binding form.
>
> (while-let (var exp)
> ...)
>
> Therefore `if-let*' should be replaced with `if-let' in the definition
> of `while-let', bringing the implementation in accordance with the
> docstring. The name `while-let' (in contrast to `while-let*') also
> suggest that the `if-let' spec is supported.
I agree that if-let is right, for these reasons. Now fixed, thank you.
--
Sean Whitton
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Fri, 13 Jan 2023 05:37:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 60758-done <at> debbugs.gnu.org (full text, mbox):
On 1/13/23 01:37, Sean Whitton wrote:
> I agree that if-let is right, for these reasons. Now fixed, thank you.
Thanks for the quick fix.
Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 15:32:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Daniel Mendler <mail <at> daniel-mendler.de> writes:
> On 1/13/23 01:37, Sean Whitton wrote:
> > I agree that if-let is right, for these reasons. Now fixed, thank
> > you.
The special case of a SPEC of the form (SYMBOL SOMETHING) is supported
only for backward compatibility by `if-let'. We wanted to get rid of
this special syntax anomaly.
So it makes no sense to add this syntax to newly introduced macros. We
should fix the docstring of `while-let' instead - unless the goal of
getting rid of this syntax has changed. But then we should have a
discussion first. Instead it seems you just reverted a change by Lars
that was the result of a discussion in emacs-dev.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 15:32:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 15:36:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 60758 <at> debbugs.gnu.org (full text, mbox):
On 1/14/23 16:31, Michael Heerdegen wrote:
> The special case of a SPEC of the form (SYMBOL SOMETHING) is supported
> only for backward compatibility by `if-let'. We wanted to get rid of
> this special syntax anomaly.
>
> So it makes no sense to add this syntax to newly introduced macros. We
> should fix the docstring of `while-let' instead - unless the goal of
> getting rid of this syntax has changed. But then we should have a
> discussion first. Instead it seems you just reverted a change by Lars
> that was the result of a discussion in emacs-dev.
But then it may make sense to deprecate `if-let` and `when-let`
altogether in favor of `if-let*` and `when-let*`? I don't think there is
anything wrong with the syntax "anomaly". I use the syntax with only a
single binding happily in many of my packages.
Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 15:36:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:13:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Daniel Mendler <mail <at> daniel-mendler.de> writes:
> But then it may make sense to deprecate `if-let` and `when-let`
> altogether in favor of `if-let*` and `when-let*`?
I don't recall why that hasn't been done. There was a very long
discussion about it. Probably the answer was "the syntax had been there
for too long and now too many packages use it and we don't want to break
them", I don't recall. Maybe you can find these discussions. There had
not been an agreement at least.
> I don't think there is anything wrong with the syntax "anomaly". I use
> the syntax with only a single binding happily in many of my packages.
The problem is the ambiguity that these syntax variations:
| An element can additionally be of the form (VALUEFORM), which is
| evaluated and checked for nil; i.e. SYMBOL can be omitted if only the
| test result is of interest. It can also be of the form SYMBOL, then the
| binding of SYMBOL is checked for nil.
create. These interpretations had been added later, but they collide
with the special handling of the (SYMBOL SOMETHING) syntax that the
original `if-let' supported.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:13:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:26:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Hello,
On Sat 14 Jan 2023 at 04:31PM +01, Michael Heerdegen wrote:
> Daniel Mendler <mail <at> daniel-mendler.de> writes:
>
>> On 1/13/23 01:37, Sean Whitton wrote:
>> > I agree that if-let is right, for these reasons. Now fixed, thank
>> > you.
>
> The special case of a SPEC of the form (SYMBOL SOMETHING) is supported
> only for backward compatibility by `if-let'. We wanted to get rid of
> this special syntax anomaly.
>
> So it makes no sense to add this syntax to newly introduced macros. We
> should fix the docstring of `while-let' instead - unless the goal of
> getting rid of this syntax has changed. But then we should have a
> discussion first. Instead it seems you just reverted a change by Lars
> that was the result of a discussion in emacs-dev.
Are you saying there was a while-let-specific discussion?
I did vc-annotate and saw that the code I was changing was in the first
commit of the new macro.
--
Sean Whitton
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:30:01 GMT)
Full text and
rfc822 format available.
Message #40 received at 60758 <at> debbugs.gnu.org (full text, mbox):
On 1/14/23 17:11, Michael Heerdegen wrote:
> Daniel Mendler <mail <at> daniel-mendler.de> writes:
>
>> But then it may make sense to deprecate `if-let` and `when-let`
>> altogether in favor of `if-let*` and `when-let*`?
>
> I don't recall why that hasn't been done. There was a very long
> discussion about it. Probably the answer was "the syntax had been there
> for too long and now too many packages use it and we don't want to break
> them", I don't recall. Maybe you can find these discussions. There had
> not been an agreement at least.
Okay, I see. Would it be possible to deprecate the single-binding syntax
via `macroexp-warn-and-return'? Or do you plan to introduce byte
compiler warnings? Given that `while-let' has been introduced without
support for single bindings it may be better then to deprecate the
starred variants in the long term, such that we end up only with
`if-let', `when-let', `while-let' etc.?
Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:30:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:36:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 60758 <at> debbugs.gnu.org (full text, mbox):
> Cc: Daniel Mendler <mail <at> daniel-mendler.de>, 60758 <at> debbugs.gnu.org,
> 60758-done <at> debbugs.gnu.org
> From: Sean Whitton <spwhitton <at> spwhitton.name>
> Date: Sat, 14 Jan 2023 09:25:26 -0700
>
> > So it makes no sense to add this syntax to newly introduced macros. We
> > should fix the docstring of `while-let' instead - unless the goal of
> > getting rid of this syntax has changed. But then we should have a
> > discussion first. Instead it seems you just reverted a change by Lars
> > that was the result of a discussion in emacs-dev.
>
> Are you saying there was a while-let-specific discussion?
>
> I did vc-annotate and saw that the code I was changing was in the first
> commit of the new macro.
Then something went wrong with vc-annotate, because that code was
modified in commit 0e72d4793c, on Sep 29, the day after the first
commit of this macro.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:59:01 GMT)
Full text and
rfc822 format available.
Message #49 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Sean Whitton <spwhitton <at> spwhitton.name> writes:
> Are you saying there was a while-let-specific discussion?
"Re: master 12f63c18f6 1/2: Add new macro 'while-let'". The archive
says you were a participant of that thread. The question about what
kind of `if-let' should be used was discussed there.
> I did vc-annotate and saw that the code I was changing was in the first
> commit of the new macro.
See Elis answer.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 16:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 21:14:02 GMT)
Full text and
rfc822 format available.
Message #55 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Hello,
On Sat 14 Jan 2023 at 06:35PM +02, Eli Zaretskii wrote:
>> Cc: Daniel Mendler <mail <at> daniel-mendler.de>, 60758 <at> debbugs.gnu.org,
>> 60758-done <at> debbugs.gnu.org
>> From: Sean Whitton <spwhitton <at> spwhitton.name>
>> Date: Sat, 14 Jan 2023 09:25:26 -0700
>>
>> > So it makes no sense to add this syntax to newly introduced macros. We
>> > should fix the docstring of `while-let' instead - unless the goal of
>> > getting rid of this syntax has changed. But then we should have a
>> > discussion first. Instead it seems you just reverted a change by Lars
>> > that was the result of a discussion in emacs-dev.
>>
>> Are you saying there was a while-let-specific discussion?
>>
>> I did vc-annotate and saw that the code I was changing was in the first
>> commit of the new macro.
>
> Then something went wrong with vc-annotate, because that code was
> modified in commit 0e72d4793c, on Sep 29, the day after the first
> commit of this macro.
Or, what is more likely, I misread the output :) My apologies for this.
We should fix the docstring or the code; there's still a bug if I just
revert my change. I haven't reviewed the old thread but it sounds like
a decision was already taken to fix the docstring instead.
Do you agree? If so, I'll replace my change.
--
Sean Whitton
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sat, 14 Jan 2023 22:15:01 GMT)
Full text and
rfc822 format available.
Message #58 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Sean Whitton <spwhitton <at> spwhitton.name> writes:
> We should fix the docstring or the code; there's still a bug if I just
> revert my change. I haven't reviewed the old thread but it sounds like
> a decision was already taken to fix the docstring instead.
> Do you agree? If so, I'll replace my change.
I'm not Eli, but I think you should fix the docstring.
Here is some part of the discussion I have found:
https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00052.html
Summary: We underestimated how many packages used the macros when we had
declared the old versions (without "*") obsolete. Lots of package
maintainers complained about the warnings they got - they could not
easily get rid of them without breaking backward compatibility of the
packages because if-let* etc (the new forms) are only available in newer
Emacs versions. So we decided to keep the old variants for now to avoid
the trouble for them.
I'm not sure when it's the right time to do it.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sun, 15 Jan 2023 07:39:02 GMT)
Full text and
rfc822 format available.
Message #61 received at 60758 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, mail <at> daniel-mendler.de,
> 60758 <at> debbugs.gnu.org
> Date: Sat, 14 Jan 2023 23:13:55 +0100
>
> Sean Whitton <spwhitton <at> spwhitton.name> writes:
>
> > We should fix the docstring or the code; there's still a bug if I just
> > revert my change. I haven't reviewed the old thread but it sounds like
> > a decision was already taken to fix the docstring instead.
> > Do you agree? If so, I'll replace my change.
>
> I'm not Eli, but I think you should fix the docstring.
I agree.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Sun, 15 Jan 2023 17:03:02 GMT)
Full text and
rfc822 format available.
Message #64 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Hello,
Done, thanks both.
--
Sean Whitton
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Mon, 16 Jan 2023 17:56:01 GMT)
Full text and
rfc822 format available.
Message #67 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Sean Whitton <spwhitton <at> spwhitton.name> writes:
> Done, thanks both.
Thank you.
I'm not yet able to see your commit, though.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Mon, 16 Jan 2023 20:37:01 GMT)
Full text and
rfc822 format available.
Message #70 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Hello,
On Mon 16 Jan 2023 at 06:55PM +01, Michael Heerdegen wrote:
> Sean Whitton <spwhitton <at> spwhitton.name> writes:
>
>> Done, thanks both.
>
> Thank you.
>
> I'm not yet able to see your commit, though.
I can see it on emacs-29, 82ae9caaddb.
--
Sean Whitton
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60758
; Package
emacs
.
(Tue, 17 Jan 2023 12:47:01 GMT)
Full text and
rfc822 format available.
Message #73 received at 60758 <at> debbugs.gnu.org (full text, mbox):
Sean Whitton <spwhitton <at> spwhitton.name> writes:
> I can see it on emacs-29, 82ae9caaddb.
Ah sorry - had been too impatient to wait for the merge.
Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 15 Feb 2023 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.