unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73596: 29.4; empty (let) does not signal an error
@ 2024-10-02 12:54 Ulrich Mueller
  2024-10-12 11:26 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2024-10-02 12:54 UTC (permalink / raw)
  To: 73596; +Cc: Stefan Monnier

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.





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-02 12:54 bug#73596: 29.4; empty (let) does not signal an error Ulrich Mueller
@ 2024-10-12 11:26 ` Eli Zaretskii
  2024-10-12 13:43   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-10-12 11:26 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: 73596, monnier

Ping!  Stefan, any comments?

> Cc: Stefan Monnier <monnier@iro.umontreal.ca>
> From: Ulrich Mueller <ulm@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.
> 
> 
> 
> 





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 11:26 ` Eli Zaretskii
@ 2024-10-12 13:43   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-10-12 13:54     ` Ulrich Mueller
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-12 13:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Ulrich Mueller, 73596

>> 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






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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 13:43   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-12 13:54     ` Ulrich Mueller
  2024-10-12 14:21       ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2024-10-12 13:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 73596

>>>>> 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?





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 13:54     ` Ulrich Mueller
@ 2024-10-12 14:21       ` Andreas Schwab
  2024-10-12 15:40         ` Ulrich Mueller
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2024-10-12 14:21 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: Eli Zaretskii, Stefan Monnier, 73596

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@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 14:21       ` Andreas Schwab
@ 2024-10-12 15:40         ` Ulrich Mueller
  2024-10-12 15:51           ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2024-10-12 15:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ulrich Mueller, Eli Zaretskii, Stefan Monnier, 73596

>>>>> 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





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 15:40         ` Ulrich Mueller
@ 2024-10-12 15:51           ` Andreas Schwab
  2024-10-12 15:57             ` Ulrich Mueller
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2024-10-12 15:51 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: Eli Zaretskii, Stefan Monnier, 73596

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@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 15:51           ` Andreas Schwab
@ 2024-10-12 15:57             ` Ulrich Mueller
  2024-10-12 16:32               ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2024-10-12 15:57 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ulrich Mueller, Eli Zaretskii, Stefan Monnier, 73596

>>>>> 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)





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 15:57             ` Ulrich Mueller
@ 2024-10-12 16:32               ` Andreas Schwab
  2024-10-13  5:04                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2024-10-12 16:32 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: Eli Zaretskii, Stefan Monnier, 73596

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@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#73596: 29.4; empty (let) does not signal an error
  2024-10-12 16:32               ` Andreas Schwab
@ 2024-10-13  5:04                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-13  5:04 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 73596, Ulrich Mueller, Eli Zaretskii, Stefan Monnier

Andreas Schwab <schwab@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.





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

end of thread, other threads:[~2024-10-13  5:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 12:54 bug#73596: 29.4; empty (let) does not signal an error Ulrich Mueller
2024-10-12 11:26 ` Eli Zaretskii
2024-10-12 13:43   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 13:54     ` Ulrich Mueller
2024-10-12 14:21       ` Andreas Schwab
2024-10-12 15:40         ` Ulrich Mueller
2024-10-12 15:51           ` Andreas Schwab
2024-10-12 15:57             ` Ulrich Mueller
2024-10-12 16:32               ` Andreas Schwab
2024-10-13  5:04                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).