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: master 68c09c6: Better CPS conversion of multi-binding `let` Date: Tue, 30 Nov 2021 08:19:19 -0500 Message-ID: References: <20211130120404.23495.29099@vcs0.savannah.gnu.org> <20211130120405.6C5F4209FD@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34578"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Mattias =?windows-1252?Q?Engdeg=E5rd?= To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 30 14:21:49 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 1ms34t-0008mD-Qz for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Nov 2021 14:21:48 +0100 Original-Received: from localhost ([::1]:42310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ms34s-0006tg-Jo for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Nov 2021 08:21:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms32c-0005cm-9L for emacs-devel@gnu.org; Tue, 30 Nov 2021 08:19:26 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ms32Z-00071c-PR for emacs-devel@gnu.org; Tue, 30 Nov 2021 08:19:25 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6786F440855; Tue, 30 Nov 2021 08:19:21 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 10F8944137D; Tue, 30 Nov 2021 08:19:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1638278360; bh=hegkrw7NuE2lwusLVkdQBwu8nudH84b1ssv/V/Ml+Vk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=nAX/730GztRch2ncTkIIH54kFFYqiBOu10F4Z2pdGSwZojtXDlQLnh6tosJM4m9De X6hggYvMYE8Oli1djlQ63MkcW6BHoAzK6XYiy3f1QqhwMrsYeuyRgIp5dUWTFZKBu3 BWl5+r89ywJTPGYDGaSOScKN2Hjwi88i1P6yy0Bifud9c7ldvjMMI2Mk1RDr3Y6JLs Bj+QsKaBiQm12eFCtEtfV0eiiYQgJz5iHHVipGQNR5lc0LswwNH64JpP4inQ3YS1AU EemhuNk4ihb3RfLllx/m8Xv23NMDtUjnhs5HgP0JJgA0Bqsxt6UYxoC9uX0YWTwLJ1 lO190VnpVGdPA== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DEEB212090D; Tue, 30 Nov 2021 08:19:19 -0500 (EST) In-Reply-To: <20211130120405.6C5F4209FD@vcs0.savannah.gnu.org> ("Mattias =?windows-1252?Q?Engdeg=E5rd=22's?= message of "Tue, 30 Nov 2021 07:04:05 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:280532 Archived-At: > - ;; Process `let' in a helper function that transforms it into a > - ;; let* with temporaries. > + (`(,(or 'let 'let*) () . ,body) > + (cps--transform-1 `(progn ,@body) next-state)) > + > + (`(let (,binding) . ,body) > + (cps--transform-1 `(let* (,binding) ,@body) next-state)) > + > + ;; Transform multi-variable `let' into `let*': > + ;; (let ((v1 e1) ... (vN eN)) BODY) > + ;; -> (let* ((t1 e1) ... (tN eN) (v1 t1) (vN tN)) BODY) I think this optimization can be generalized to the multi-var case by noticing that the transformation of (vN eN) into a pair (tN eN) ... (vN tN) is not necessary because the order of the (v1 t1) ... (vN tN) doesn't matter so we can move (vN tN) to the beginning, right next to (tN eN) and then merge them back. Stefan