unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25154@debbugs.gnu.org
Subject: bug#25154: 25.1; Bindings in cl-letf are in reverse order
Date: Sat, 10 Dec 2016 13:52:34 -0600	[thread overview]
Message-ID: <87zik3wohp.fsf@gmail.com> (raw)
In-Reply-To: <838trnfxlv.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 10 Dec 2016 20:27:40 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: 25154@debbugs.gnu.org
>> Date: Sat, 10 Dec 2016 12:05:40 -0600
>> 
>> > 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
>
> That's the evaluation order.

Yes, which is what the (nreverse binds) in my patch actually affects,
despite the name of the variable being `binds'. This is why I said that
my choice of wording for this bug report was wrong, as it focused on a
less important problem.

As said in my last email, the expression:

(cl-letf (((aref v 1) 10)
          ((aref w 2) 20))
  (aref v 1))

expands to:

(let*
    ((v v)
     (v w)
     (old
      (aref v 2))
     (old
      (aref v 1)))
  (unwind-protect
      (progn
        (aset v 2 20)
        (aset v 1 10)
        (aref v 1))
    (aset v 2 old)
    (aset v 1 old)))

which does indeed evaluate the arefs and asets in reverse order. This is
the most important part of my patch.

> Your code relies on the order of
> _binding_ variables to values, which is unspecified.  Contrast the
> above with the description of 'let*' below it.

Just the (nreverse simplebinds) line, which I added just to make cl-letf
a little bit saner (i.e. more like let). This part does seem to be
unspecified, but I don't see why it should unnecessarily diverge from
let.





  reply	other threads:[~2016-12-10 19:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 23:36 bug#25154: 25.1; Bindings in cl-letf are in reverse order Alex
2016-12-10  4:29 ` Alex
2016-12-10  7:22 ` Eli Zaretskii
2016-12-10  7:43   ` Tino Calancha
2016-12-10 13:41     ` Philipp Stephani
2016-12-10 14:01       ` Tino Calancha
2016-12-10 14:09       ` Eli Zaretskii
2016-12-23 12:17         ` Philipp Stephani
2016-12-23 12:46           ` Tino Calancha
2016-12-23 13:53           ` Eli Zaretskii
2016-12-23 16:30             ` Philipp Stephani
2016-12-10 18:05   ` Alex
2016-12-10 18:14     ` npostavs
2016-12-10 19:41       ` Alex
2016-12-10 18:27     ` Eli Zaretskii
2016-12-10 19:52       ` Alex [this message]
2016-12-11  3:11         ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zik3wohp.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=25154@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).