GNU bug report logs - #67116
byte-compile-let: reversing the order of evaluation of the clauses CAN make a difference.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 11 Nov 2023 22:50:01 UTC

Severity: normal

Done: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 67116 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Alan Mackenzie <acm <at> muc.de>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "67116 <at> debbugs.gnu.org" <67116 <at> debbugs.gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: RE: [External] : bug#67116: byte-compile-let: reversing the order of
 evaluation of the clauses CAN make a difference.
Date: Sun, 12 Nov 2023 19:32:23 +0000
> > 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.

Yes.  And FWIW Common Lisp does the same (which
likely means that most other Lisps at that time
did the same).

  first evaluates the expressions value1, value2,
  and so on, in that order, saving the resulting values.
  Then all of the variables varj are bound to the
  corresponding values in parallel

https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node83.html




This bug report was last modified 1 year and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.