all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Naoya Yamashita <conao3@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP
Date: Mon, 01 Mar 2021 21:48:13 -0500	[thread overview]
Message-ID: <jwv4khunumk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20210302.111043.609653289571449353.conao3@gmail.com> (Naoya Yamashita's message of "Tue, 02 Mar 2021 11:10:43 +0900 (JST)")

> I found src/eval.c (let) has redundant conditions, that compares
> the length of the list with the current index and also checks if
> the current list is cons.

The patch looks fine, thank you.

Just one detail about the tests: the change you made affects the
evaluation of `let` in the case where the code is interpreted but it
is not used when the code is byte-compiled.  So you might like your
tests to use things like

    (eval '(let ...) t)

to avoid the compiler getting in the way.

> +  ;; (error "`let' bindings can have only one value-form" a 1 2)
> +  (should-error (let ((a 1 2))
> +                  a)
> +                :type 'error)

Also, while this `let` is indeed invalid code, I don't think we
guarantee that it will signal an error, and especially not at runtime
(it's more likely to signal an error at macroexpansion or compile
time).

I think the compiler (or `macroexpand-all`) should make an effort to
detect and diagnose those problems, but I don't think it's important to
catch those problems in the interpreter.


        Stefan




  reply	other threads:[~2021-03-02  2:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02  2:10 [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP Naoya Yamashita
2021-03-02  2:48 ` Stefan Monnier [this message]
2021-03-02  3:09   ` Naoya Yamashita
2021-03-02 14:31     ` Stefan Monnier
2021-03-02 15:19       ` Pip Cet
2021-03-02 15:48         ` Stefan Monnier
2021-03-02 17:04           ` Pip Cet
2021-03-02 17:44             ` Stefan Monnier
2021-03-02 19:50               ` Pip Cet
2021-03-02 23:48                 ` Stefan Monnier
2021-03-02  5:34 ` Pip Cet
2021-03-02  5:41 ` Eli Zaretskii
2021-03-02  7:14   ` Naoya Yamashita
2021-03-02  7:30     ` Pip Cet
2021-03-02 14:00     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4khunumk.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=conao3@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.