From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP Date: Mon, 01 Mar 2021 21:48:13 -0500 Message-ID: References: <20210302.111043.609653289571449353.conao3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31777"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Naoya Yamashita Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 02 03:51:44 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGv8S-00088J-0m for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Mar 2021 03:51:44 +0100 Original-Received: from localhost ([::1]:47738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGv8Q-0000ru-VV for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Mar 2021 21:51:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGv79-0000JJ-DE for emacs-devel@gnu.org; Mon, 01 Mar 2021 21:50:23 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGv57-0003NG-Ks for emacs-devel@gnu.org; Mon, 01 Mar 2021 21:50:17 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 12C6B80A5C; Mon, 1 Mar 2021 21:48:16 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 83EBF8078F; Mon, 1 Mar 2021 21:48:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1614653294; bh=hN/dzkmmxDt8ga7fIIoVPfKzeLKSwsb12WIBpukVpGQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Q4QwUu24ZXUJGApNBhyLsT3hzZx9sAh79+K2EWHjOzEVWBTmCpp2mAFAqwbeh61TP 2bVEAnWFBBRnpDvexyNSM5qc8RCL7a7HC53AKm/jCNCuJTv2g+emUDHw1LKX9dBYXM ByXzCaGutVzZRjQR33Uk1y7/21/cz2lQDw+duPDkqSnDcRJpqX+AJFQr93LHVgkkrq Nu4k8d6UAgws2M59XxIwkiWu1ZcyRmGf0ZJs1zFo/iq8BwaLQ6zaetXRngOPJsQ9Se vq4D+Fbzu9SrwCAAclum3jXvel/su2pW+wcJHdU1sff6wvjlTc4t9lbbHXnAW5vHLi NwCC2ECBNxO1w== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 555D2120305; Mon, 1 Mar 2021 21:48:14 -0500 (EST) In-Reply-To: <20210302.111043.609653289571449353.conao3@gmail.com> (Naoya Yamashita's message of "Tue, 02 Mar 2021 11:10:43 +0900 (JST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265797 Archived-At: > 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