From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#67116: byte-compile-let: reversing the order of evaluation of the clauses CAN make a difference. Date: Sun, 12 Nov 2023 14:22:26 +0000 Message-ID: References: <83r0kvv6r0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6814"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67116@debbugs.gnu.org, acm@muc.de, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 12 15:23:31 2023 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 1r2BN5-0001Yb-3e for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 15:23:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2BMy-0002bm-4C; Sun, 12 Nov 2023 09:23:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2BMv-0002bS-Ni for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 09:23:21 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2BMv-0003jj-Fr for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 09:23:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2BNa-00070m-De for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 09:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Nov 2023 14:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67116 X-GNU-PR-Package: emacs Original-Received: via spool by 67116-submit@debbugs.gnu.org id=B67116.169979900126888 (code B ref 67116); Sun, 12 Nov 2023 14:24:02 +0000 Original-Received: (at 67116) by debbugs.gnu.org; 12 Nov 2023 14:23:21 +0000 Original-Received: from localhost ([127.0.0.1]:55257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2BMu-0006zb-Jh for submit@debbugs.gnu.org; Sun, 12 Nov 2023 09:23:21 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:53133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2BMr-0006zN-VV for 67116@debbugs.gnu.org; Sun, 12 Nov 2023 09:23:19 -0500 Original-Received: (qmail 48842 invoked by uid 3782); 12 Nov 2023 15:22:31 +0100 Original-Received: from acm.muc.de (pd953a91f.dip0.t-ipconnect.de [217.83.169.31]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 12 Nov 2023 15:22:30 +0100 Original-Received: (qmail 22071 invoked by uid 1000); 12 Nov 2023 14:22:27 -0000 Content-Disposition: inline In-Reply-To: <83r0kvv6r0.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274204 Archived-At: Hello, Eli. On Sun, Nov 12, 2023 at 08:13:39 +0200, Eli Zaretskii wrote: > > Cc: 67116@debbugs.gnu.org > > Date: Sat, 11 Nov 2023 23:52:38 -0500 > > From: Stefan Monnier via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" > > > In lisp/emacs-lisp/bytecomp.el (byte-compile-let), when the following > > > form (from jit-lock--debug-fontify): > > > (let > > > ((beg pos) > > > (end (setq pos > > > (next-single-property-change > > > pos 'fontified > > > nil (point-max))))) > > > (put-text-property beg end 'fontified nil) > > > (jit-lock-fontify-now beg end)) > > > gets byte compiled, the order of evaluating BEG and END gets reversed so > > > that END gets evaluated first. > > Sounds like a bug. > It does? I always thought that the order of evaluation in a let form > is unspecified, and in practice I had several bugs of exactly this > nature, which I fixed by using let*, as expected. No. The order of _evaluation_ is specified as top to bottom. The order of _binding_ is unspecified. Quoting from the elisp.info page "Local Variables": All of the VALUE-FORMs in BINDINGS are evaluated in the order they appear and _before_ binding any of the symbols to them. and a little later on the same page: On the other hand, the order of _bindings_ is unspecified: > Why on Earth should we require any particular order of evaluation in a > let form?? To make the value of a form unambiguous? In any case, we do require a particular order. -- Alan Mackenzie (Nuremberg, Germany).