GNU bug report logs - #25154
25.1; Bindings in cl-letf are in reverse order

Previous Next

Package: emacs;

Reported by: Alex <agrambot <at> gmail.com>

Date: Fri, 9 Dec 2016 23:55:02 UTC

Severity: minor

Tags: notabug

Found in version 25.1

Done: Philipp Stephani <p.stephani2 <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: npostavs <at> users.sourceforge.net
To: Alex <agrambot <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 25154 <at> debbugs.gnu.org
Subject: Re: bug#25154: 25.1; Bindings in cl-letf are in reverse order
Date: Sat, 10 Dec 2016 13:14:54 -0500
Alex <agrambot <at> gmail.com> writes:

>>
>> Isn't it true that the order of evaluation in a 'let' is unspecified?
>> If you want a particular order, use 'let*'.
>
> I don't think so. See (info "(elisp) Local Variables"):
>
>   All of the VALUE-FORMs in BINDINGS are evaluated in the order they
>   appear
>
> I believe it should follow for cl-letf. Besides, even if it was
> unspecified, evaluating in the order they appear would be adhering to
> the principle of least astonishment.

The value forms are evaluated in order, the bindings are not necessarily
in order.

(let ((x 0))
  (cl-letf ((a (setq x 1))
            (a (setq x 2)))
    (list x a))) ;=> (2 1)

Although `let' does happen to perform the bindings in order too.

(let ((x 0))
  (let ((a (setq x 1))
        (a (setq x 2)))
    (list x a))) ;=> (2 2)




This bug report was last modified 8 years and 150 days ago.

Previous Next


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