GNU bug report logs - #73596
29.4; empty (let) does not signal an error

Previous Next

Package: emacs;

Reported by: Ulrich Mueller <ulm <at> gentoo.org>

Date: Wed, 2 Oct 2024 12:55:02 UTC

Severity: normal

Tags: wontfix

Found in version 29.4

Done: Stefan Kangas <stefankangas <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 73596 in the body.
You can then email your comments to 73596 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#73596; Package emacs. (Wed, 02 Oct 2024 12:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ulrich Mueller <ulm <at> gentoo.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 02 Oct 2024 12:55:02 GMT) Full text and rfc822 format available.

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

From: Ulrich Mueller <ulm <at> gentoo.org>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: 29.4; empty (let) does not signal an error
Date: Wed, 02 Oct 2024 14:54:00 +0200
Not sure if the following is an error or the intended behavior.

IIUC empty (let) should signal an error, and it did so in Emacs 27.2.
However, it returns nil now.

Apparently the new behavior was introduced by commit d41a4ad4ae6f.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 11:27:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Mueller <ulm <at> gentoo.org>
Cc: 73596 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 14:26:20 +0300
Ping!  Stefan, any comments?

> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> From: Ulrich Mueller <ulm <at> gentoo.org>
> Date: Wed, 02 Oct 2024 14:54:00 +0200
> 
> Not sure if the following is an error or the intended behavior.
> 
> IIUC empty (let) should signal an error, and it did so in Emacs 27.2.
> However, it returns nil now.
> 
> Apparently the new behavior was introduced by commit d41a4ad4ae6f.
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 13:52:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Mueller <ulm <at> gentoo.org>, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 09:43:53 -0400
>> Not sure if the following is an error or the intended behavior.
>> IIUC empty (let) should signal an error, and it did so in Emacs 27.2.
>> However, it returns nil now.

The compiler emits a warning when encountering a `let` without a body,
which I think is the most important aspect.

Returning nil (when the user decides to run the code despite the
warning) seems just as good as signaling an error.  Just don't rely on it.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 13:56:02 GMT) Full text and rfc822 format available.

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

From: Ulrich Mueller <ulm <at> gentoo.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 15:54:56 +0200
>>>>> On Sat, 12 Oct 2024, Stefan Monnier wrote:

>>> Not sure if the following is an error or the intended behavior.
>>> IIUC empty (let) should signal an error, and it did so in Emacs 27.2.
>>> However, it returns nil now.

> The compiler emits a warning when encountering a `let` without a body,
> which I think is the most important aspect.

> Returning nil (when the user decides to run the code despite the
> warning) seems just as good as signaling an error.  Just don't rely on it.

(func-arity 'let)  ⇒  (1 . unevalled)

Shouldn't this be updated to return (0 . unevalled) when empty (let)
is allowed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 14:23:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Ulrich Mueller <ulm <at> gentoo.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 16:21:23 +0200
On Okt 12 2024, Ulrich Mueller wrote:

> (func-arity 'let)  ⇒  (1 . unevalled)
>
> Shouldn't this be updated to return (0 . unevalled) when empty (let)
> is allowed?

$ emacs -batch -eval '(let)'

Error: wrong-number-of-arguments (let 0)
  (let)
  eval((let) t)
  command-line-1(("-eval" "(let)"))
  command-line()
  normal-top-level()
Wrong number of arguments: let, 0

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 15:52:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Ulrich Mueller <ulm <at> gentoo.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 17:51:40 +0200
On Okt 12 2024, Ulrich Mueller wrote:

> $ emacs -Q
> M-: (let) RET
> ⇒ nil

Don't use eval-expression.  It does not evaluate the form, but something
else.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 16:06:02 GMT) Full text and rfc822 format available.

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

From: Ulrich Mueller <ulm <at> gentoo.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Ulrich Mueller <ulm <at> gentoo.org>, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 17:57:03 +0200
>>>>> On Sat, 12 Oct 2024, Andreas Schwab wrote:

> On Okt 12 2024, Ulrich Mueller wrote:
>> $ emacs -Q
>> M-: (let) RET
>> ⇒ nil

> Don't use eval-expression.  It does not evaluate the form, but something
> else.

Well, it's the same with eval-last-sexp. And behavior has definitely
changed, with Emacs 29.4 (as well as 31.0.50) I see a nil result, while
with Emacs 27.2 I get:

Debugger entered--Lisp error: (wrong-number-of-arguments let 0)
  (let)
  (progn (let))
  eval((progn (let)) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 16:41:04 GMT) Full text and rfc822 format available.

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

From: Ulrich Mueller <ulm <at> gentoo.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Ulrich Mueller <ulm <at> gentoo.org>, Eli Zaretskii <eliz <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 17:40:30 +0200
>>>>> On Sat, 12 Oct 2024, Andreas Schwab wrote:

> On Okt 12 2024, Ulrich Mueller wrote:
>> (func-arity 'let)  ⇒  (1 . unevalled)
>> 
>> Shouldn't this be updated to return (0 . unevalled) when empty (let)
>> is allowed?

> $ emacs -batch -eval '(let)'

> Error: wrong-number-of-arguments (let 0)
>   (let)
>   eval((let) t)
>   command-line-1(("-eval" "(let)"))
>   command-line()
>   normal-top-level()
> Wrong number of arguments: let, 0

That's even stranger then, because it seems to depend on how Emacs
is invoked:

$ echo "(princ (let))" >foo.el
$ emacs -Q -batch -L . -l foo.el
nil

$ emacs -Q
M-: (let) RET
⇒ nil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sat, 12 Oct 2024 16:59:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Ulrich Mueller <ulm <at> gentoo.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 12 Oct 2024 18:32:48 +0200
On Okt 12 2024, Ulrich Mueller wrote:

>>>>>> On Sat, 12 Oct 2024, Andreas Schwab wrote:
>
>> On Okt 12 2024, Ulrich Mueller wrote:
>>> $ emacs -Q
>>> M-: (let) RET
>>> ⇒ nil
>
>> Don't use eval-expression.  It does not evaluate the form, but something
>> else.
>
> Well, it's the same with eval-last-sexp.

That's because does the same.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sun, 13 Oct 2024 05:05:01 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 73596 <at> debbugs.gnu.org, Ulrich Mueller <ulm <at> gentoo.org>,
 Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sun, 13 Oct 2024 07:04:42 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> >> Don't use eval-expression.  It does not evaluate the form, but something
> >> else.
> >
> > Well, it's the same with eval-last-sexp.
>
> That's because does the same.

At the end it's due to (macroexpand-all '(let ())) -> (let () nil).

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sun, 27 Oct 2024 10:24:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: ulm <at> gentoo.org, monnier <at> iro.umontreal.ca, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sun, 27 Oct 2024 12:22:19 +0200
Ping! What should we do with this bug report?  Close it?

> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,  Eli Zaretskii
>  <eliz <at> gnu.org>,  73596 <at> debbugs.gnu.org
> Date: Sat, 12 Oct 2024 18:32:48 +0200
> 
> On Okt 12 2024, Ulrich Mueller wrote:
> 
> >>>>>> On Sat, 12 Oct 2024, Andreas Schwab wrote:
> >
> >> On Okt 12 2024, Ulrich Mueller wrote:
> >>> $ emacs -Q
> >>> M-: (let) RET
> >>> ⇒ nil
> >
> >> Don't use eval-expression.  It does not evaluate the form, but something
> >> else.
> >
> > Well, it's the same with eval-last-sexp.
> 
> That's because does the same.
> 
> -- 
> Andreas Schwab, schwab <at> linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sun, 27 Oct 2024 10:50:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ulm <at> gentoo.org, monnier <at> iro.umontreal.ca, 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sun, 27 Oct 2024 11:49:15 +0100
If there is a bug then it is that eval-expression and eval-last-sexp
call macroexpand-all.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#73596; Package emacs. (Sun, 03 Nov 2024 06:00:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Ulrich Mueller <ulm <at> gentoo.org>,
 73596 <at> debbugs.gnu.org
Subject: Re: bug#73596: 29.4; empty (let) does not signal an error
Date: Sat, 2 Nov 2024 22:58:30 -0700
tags 73596 + wontfix
close 73596
thanks

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> Not sure if the following is an error or the intended behavior.
>>> IIUC empty (let) should signal an error, and it did so in Emacs 27.2.
>>> However, it returns nil now.
>
> The compiler emits a warning when encountering a `let` without a body,
> which I think is the most important aspect.
>
> Returning nil (when the user decides to run the code despite the
> warning) seems just as good as signaling an error.  Just don't rely on it.

Further discussion revealed that we don't see the need to make any
changes here.  I'm therefore closing this bug report now.




Added tag(s) wontfix. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 03 Nov 2024 06:00:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 73596 <at> debbugs.gnu.org and Ulrich Mueller <ulm <at> gentoo.org> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 03 Nov 2024 06:00:03 GMT) Full text and rfc822 format available.

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

This bug report was last modified 198 days ago.

Previous Next


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