From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#51982: Erroneous handling of local variables in byte-compiled nested lambdas Date: Thu, 2 Dec 2021 10:13:31 +0100 Message-ID: References: <87y25jo2q1.fsf@web.de> <29C3A3F8-CD9F-4AF2-A731-3304FC30E380@acm.org> <87wnl23pnd.fsf@web.de> <59A729EF-C4D4-47EB-9ADC-19FE8EBE7F10@acm.org> <877dd0bi17.fsf@web.de> <6EA55EF4-D5B2-490E-B1FF-DC86A034C893@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24039"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , Paul Pogonyshev , 51982@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 02 10:14:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1msiAN-00063D-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 10:14:11 +0100 Original-Received: from localhost ([::1]:35248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msiAM-0003nW-4R for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 04:14:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msiAG-0003nD-7Q for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 04:14:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msiAE-000544-Cs for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 04:14:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msiAE-0006kP-8b for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 04:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Dec 2021 09:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51982 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51982-submit@debbugs.gnu.org id=B51982.163843642525908 (code B ref 51982); Thu, 02 Dec 2021 09:14:02 +0000 Original-Received: (at 51982) by debbugs.gnu.org; 2 Dec 2021 09:13:45 +0000 Original-Received: from localhost ([127.0.0.1]:46561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msi9x-0006jn-Et for submit@debbugs.gnu.org; Thu, 02 Dec 2021 04:13:45 -0500 Original-Received: from mail212c50.megamailservers.eu ([91.136.10.222]:36806 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msi9v-0006jY-80 for 51982@debbugs.gnu.org; Thu, 02 Dec 2021 04:13:44 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1638436415; bh=DB2VTS4XXFrvhGy5+4dlvken3wDoVvqeR2IMQF2ee2Q=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=dXEGsleGs/oLYMp1f5QJsA68aPjFkojbQGjBryf3ixJJ5/v6R1AbzPcJqSMEnDBWK Mw9QLX+9mUaO7JUAGOENWzsePJQyaz37fXlex2HnXz0tuWRsYG7fh7b4uahOnKNECB EvBLSr6qeGtdIiZkGCSKLU+JaDjNgVDX9B/Up3y0= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 1B29DV9S022584; Thu, 2 Dec 2021 09:13:33 +0000 In-Reply-To: <6EA55EF4-D5B2-490E-B1FF-DC86A034C893@acm.org> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F27.61A88E3F.005D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=Dv41REz+ c=1 sm=1 tr=0 ts=61a88e3f a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=NB-phzwo78Iuget5PpkA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221267 Archived-At: > Yes, and I can confirm that both transformations (let* -> let and the = inverse) seem to generate almost or exactly identical bytecode for = lexbind code. If you can find an example where it's worse, I'd like to = know. And by "yes" I mean "no", since the identical bytecode is only true in = the absence of mutation which, as always, throws a spanner in the works. = For example, while (let ((x (sin y)) (y (cos x))) (+ x y)))) -> (let* ((x0 (sin y)) (y (cos x)) (x x0)) (+ x y)))) is a transformation with identical bytecode, mutating one of the = variables: (let ((x (sin y)) (y (cos x))) (setq x (1+ x)) (+ x y)))) -> (let* ((x0 (sin y)) (y (cos x)) (x x0)) (setq x (1+ x)) (+ x y)))) will prevent the intermediate from being eliminated. Not a disaster by = any means but not good enough as a general method of translation.