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 #8 received at 25154 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: 25154 <at> debbugs.gnu.org
Subject: Re: 25.1; Bindings in cl-letf are in reverse order
Date: Fri, 09 Dec 2016 22:29:36 -0600
[Message part 1 (text/plain, inline)]
Alex <agrambot <at> gmail.com> writes:

> Compare the following:
>
> (let ((x 5)
>       (x 6))
>   (+ x 10))
>
> => 16
>
> (cl-letf ((x 5)
>           (x 6))
>   (+ x 10))
>
> => 15
>
>
> This also occurs when using non-trivial places:
>
> (setq v (vector 1 2 3 4 5))
>
> (cl-letf (((aref v 1) 10)
>           ((aref v 1) 20))
>   (aref v 1))
>
> => 10
>
>
> I ran into this when using two different setters that sometimes
> indirectly modify the same variable. The current behaviour makes the
> result of that unexpected.

I attached a patch that fixes this issue:

[0001-Preserve-the-order-of-bindings-in-cl-letf.patch (text/x-patch, attachment)]

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.