unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 25154@debbugs.gnu.org, agrambot@gmail.com, tino.calancha@gmail.com
Subject: bug#25154: 25.1; Bindings in cl-letf are in reverse order
Date: Fri, 23 Dec 2016 21:46:39 +0900	[thread overview]
Message-ID: <8760ma4xu8.fsf@gmail.com> (raw)
In-Reply-To: <CAArVCkS=F6ZGwSBgum-ST31t_0+nY9oRAkqFofSb4FHFXYdCZA@mail.gmail.com> (Philipp Stephani's message of "Fri, 23 Dec 2016 12:17:54 +0000")

Philipp Stephani <p.stephani2@gmail.com> writes:

>  I agree, patches to that effect are welcome.  (AFAICT, the manual
>  tries to say that already, but the wording could be more explicit.)
>
> OK, I've attached a patch that hopefully clarifies this a bit. 
>
> From 42d7450c41d69a713eb8f9492cc169e8c2bc15ca Mon Sep 17 00:00:00 2001
> From: Philipp Stephani <phst@google.com>
> Date: Fri, 23 Dec 2016 13:14:55 +0100
> Subject: [PATCH] Document that variable binding order is unspecified
>
> * doc/lispref/variables.texi (Local Variables):
> * cl.texi (Modify Macros): Document that assignment order in 'let' and
> 'cl-letf' is unspecified.
> ---
>  doc/lispref/variables.texi | 12 ++++++++++++
>  doc/misc/cl.texi           |  5 +++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
> index a2d64815d9..e2c8c542ab 100644
> --- a/doc/lispref/variables.texi
> +++ b/doc/lispref/variables.texi
> @@ -221,6 +221,18 @@ Local Variables
>       @result{} (1 2)
>  @end group
>  @end example
> +
> +On the other hand, the order of @emph{assignments} is unspecified: in
> +the following example, either 1 or 2 might be printed.
> +
> +@example
> +(let ((x 1)
> +      (x 2))
> +  (print x))
> +@end example
> +
> +Therefore, avoid binding a variable more than once in a single
> +@code{let} form.
>  @end defspec
>  
>  @defspec let* (bindings@dots{}) forms@dots{}
> diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
> index c62fa727c1..aa047e2122 100644
> --- a/doc/misc/cl.texi
> +++ b/doc/misc/cl.texi
> @@ -1179,6 +1179,11 @@ Modify Macros
>  as @code{setf} places; each will accept either an integer or a
>  marker as the stored value.)
>  
> +Like in the case of @code{let}, the @var{value} forms are evaluated in
> +the order they appear, but the order of assignments is unspecified.
> +Therefore, avoid assigning to the same @var{place} more than once in a
> +single @code{cl-letf} form.
> +
>  Since generalized variables look like lists, @code{let}'s shorthand
>  of using @samp{foo} for @samp{(foo nil)} as a @var{binding} would
>  be ambiguous in @code{cl-letf} and is not allowed.

It looks good to me.  Thank you.
Tino





  reply	other threads:[~2016-12-23 12:46 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 [this message]
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
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=8760ma4xu8.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=25154@debbugs.gnu.org \
    --cc=agrambot@gmail.com \
    --cc=p.stephani2@gmail.com \
    /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).