unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
@ 2023-01-12 19:21 Daniel Mendler
  2023-01-13  0:37 ` Sean Whitton
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Mendler @ 2023-01-12 19:21 UTC (permalink / raw)
  To: 60758

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)





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-12 19:21 bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring Daniel Mendler
@ 2023-01-13  0:37 ` Sean Whitton
  2023-01-13  5:36   ` Daniel Mendler
  0 siblings, 1 reply; 17+ messages in thread
From: Sean Whitton @ 2023-01-13  0:37 UTC (permalink / raw)
  To: Daniel Mendler; +Cc: 60758-done

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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-13  0:37 ` Sean Whitton
@ 2023-01-13  5:36   ` Daniel Mendler
  2023-01-14 15:31     ` Michael Heerdegen
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Mendler @ 2023-01-13  5:36 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 60758-done

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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-13  5:36   ` Daniel Mendler
@ 2023-01-14 15:31     ` Michael Heerdegen
  2023-01-14 15:35       ` Daniel Mendler
  2023-01-14 16:25       ` Sean Whitton
  0 siblings, 2 replies; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-14 15:31 UTC (permalink / raw)
  To: Daniel Mendler; +Cc: 60758-done, 60758, Sean Whitton

Daniel Mendler <mail@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 15:31     ` Michael Heerdegen
@ 2023-01-14 15:35       ` Daniel Mendler
  2023-01-14 16:11         ` Michael Heerdegen
  2023-01-14 16:25       ` Sean Whitton
  1 sibling, 1 reply; 17+ messages in thread
From: Daniel Mendler @ 2023-01-14 15:35 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 60758-done, 60758, Sean Whitton

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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 15:35       ` Daniel Mendler
@ 2023-01-14 16:11         ` Michael Heerdegen
  2023-01-14 16:29           ` Daniel Mendler
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-14 16:11 UTC (permalink / raw)
  To: Daniel Mendler; +Cc: Sean Whitton, 60758, 60758-done

Daniel Mendler <mail@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 15:31     ` Michael Heerdegen
  2023-01-14 15:35       ` Daniel Mendler
@ 2023-01-14 16:25       ` Sean Whitton
  2023-01-14 16:35         ` Eli Zaretskii
  2023-01-14 16:58         ` Michael Heerdegen
  1 sibling, 2 replies; 17+ messages in thread
From: Sean Whitton @ 2023-01-14 16:25 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Daniel Mendler, 60758, 60758-done

Hello,

On Sat 14 Jan 2023 at 04:31PM +01, Michael Heerdegen wrote:

> Daniel Mendler <mail@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 16:11         ` Michael Heerdegen
@ 2023-01-14 16:29           ` Daniel Mendler
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Mendler @ 2023-01-14 16:29 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Sean Whitton, 60758, 60758-done

On 1/14/23 17:11, Michael Heerdegen wrote:
> Daniel Mendler <mail@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 16:25       ` Sean Whitton
@ 2023-01-14 16:35         ` Eli Zaretskii
  2023-01-14 21:13           ` Sean Whitton
  2023-01-14 16:58         ` Michael Heerdegen
  1 sibling, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2023-01-14 16:35 UTC (permalink / raw)
  To: Sean Whitton; +Cc: michael_heerdegen, mail, 60758

> Cc: Daniel Mendler <mail@daniel-mendler.de>, 60758@debbugs.gnu.org,
>  60758-done@debbugs.gnu.org
> From: Sean Whitton <spwhitton@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 16:25       ` Sean Whitton
  2023-01-14 16:35         ` Eli Zaretskii
@ 2023-01-14 16:58         ` Michael Heerdegen
  1 sibling, 0 replies; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-14 16:58 UTC (permalink / raw)
  To: Sean Whitton; +Cc: Daniel Mendler, 60758, 60758-done

Sean Whitton <spwhitton@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 16:35         ` Eli Zaretskii
@ 2023-01-14 21:13           ` Sean Whitton
  2023-01-14 22:13             ` Michael Heerdegen
  0 siblings, 1 reply; 17+ messages in thread
From: Sean Whitton @ 2023-01-14 21:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael_heerdegen, mail, 60758

Hello,

On Sat 14 Jan 2023 at 06:35PM +02, Eli Zaretskii wrote:

>> Cc: Daniel Mendler <mail@daniel-mendler.de>, 60758@debbugs.gnu.org,
>>  60758-done@debbugs.gnu.org
>> From: Sean Whitton <spwhitton@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 21:13           ` Sean Whitton
@ 2023-01-14 22:13             ` Michael Heerdegen
  2023-01-15  7:38               ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-14 22:13 UTC (permalink / raw)
  To: Sean Whitton; +Cc: mail, Eli Zaretskii, 60758

Sean Whitton <spwhitton@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-14 22:13             ` Michael Heerdegen
@ 2023-01-15  7:38               ` Eli Zaretskii
  2023-01-15 17:02                 ` Sean Whitton
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2023-01-15  7:38 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: mail, 60758, spwhitton

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: Eli Zaretskii <eliz@gnu.org>,  mail@daniel-mendler.de,
>   60758@debbugs.gnu.org
> Date: Sat, 14 Jan 2023 23:13:55 +0100
> 
> Sean Whitton <spwhitton@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-15  7:38               ` Eli Zaretskii
@ 2023-01-15 17:02                 ` Sean Whitton
  2023-01-16 17:55                   ` Michael Heerdegen
  0 siblings, 1 reply; 17+ messages in thread
From: Sean Whitton @ 2023-01-15 17:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Heerdegen, mail, 60758

Hello,

Done, thanks both.

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-15 17:02                 ` Sean Whitton
@ 2023-01-16 17:55                   ` Michael Heerdegen
  2023-01-16 20:36                     ` Sean Whitton
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-16 17:55 UTC (permalink / raw)
  To: Sean Whitton; +Cc: mail, Eli Zaretskii, 60758

Sean Whitton <spwhitton@spwhitton.name> writes:

> Done, thanks both.

Thank you.

I'm not yet able to see your commit, though.


Michael.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-16 17:55                   ` Michael Heerdegen
@ 2023-01-16 20:36                     ` Sean Whitton
  2023-01-17 12:46                       ` Michael Heerdegen
  0 siblings, 1 reply; 17+ messages in thread
From: Sean Whitton @ 2023-01-16 20:36 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: mail, Eli Zaretskii, 60758

Hello,

On Mon 16 Jan 2023 at 06:55PM +01, Michael Heerdegen wrote:

> Sean Whitton <spwhitton@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring
  2023-01-16 20:36                     ` Sean Whitton
@ 2023-01-17 12:46                       ` Michael Heerdegen
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Heerdegen @ 2023-01-17 12:46 UTC (permalink / raw)
  To: Sean Whitton; +Cc: mail, Eli Zaretskii, 60758

Sean Whitton <spwhitton@spwhitton.name> writes:

> I can see it on emacs-29, 82ae9caaddb.

Ah sorry - had been too impatient to wait for the merge.

Michael.






^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-01-17 12:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 19:21 bug#60758: 29.0.60; while-let uses if-let* convention in contradiction to the docstring Daniel Mendler
2023-01-13  0:37 ` Sean Whitton
2023-01-13  5:36   ` Daniel Mendler
2023-01-14 15:31     ` Michael Heerdegen
2023-01-14 15:35       ` Daniel Mendler
2023-01-14 16:11         ` Michael Heerdegen
2023-01-14 16:29           ` Daniel Mendler
2023-01-14 16:25       ` Sean Whitton
2023-01-14 16:35         ` Eli Zaretskii
2023-01-14 21:13           ` Sean Whitton
2023-01-14 22:13             ` Michael Heerdegen
2023-01-15  7:38               ` Eli Zaretskii
2023-01-15 17:02                 ` Sean Whitton
2023-01-16 17:55                   ` Michael Heerdegen
2023-01-16 20:36                     ` Sean Whitton
2023-01-17 12:46                       ` Michael Heerdegen
2023-01-14 16:58         ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).