all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: balducci@units.it
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	63586@debbugs.gnu.org
Subject: bug#63586: 29.x: dotimes (possible) problem
Date: Fri, 19 May 2023 17:54:48 +0200	[thread overview]
Message-ID: <D0DD1925-FF93-44EF-83D4-56E970922F9C@acm.org> (raw)
In-Reply-To: <4450.1684509068@dschgrazlin2.units.it>

Hello Gabriele,

> changing the value of the loop variable in the body of dotimes does not seem to have any effect, where for versions <29.x it used to.

Prior to Emacs 29, the `dotimes` macro expanded to different code depending on whether lexical-binding was used or not, implicitly permitting your practice of altering the loop counter in code using dynamic binding.

However, the macro was probably never intended to be used that way, and your example does not work with lexical binding in any version as far as I can tell.

If you want to terminate your loop early, use catch/throw or a different loop construct altogether: while, named-let, or cl-loop, just to name a few.

> changing the value of the loop variable from inside the loop
> body is supported by any other language which I know about

Then you should learn more languages!

And you should use lexical-binding:t in all your elisp code. Always.







  reply	other threads:[~2023-05-19 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 15:10 bug#63586: 29.x: dotimes (possible) problem balducci
2023-05-19 15:54 ` Mattias Engdegård [this message]
2023-05-19 16:00 ` Eli Zaretskii
2023-05-19 17:29   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-19 17:33     ` Drew Adams
2023-05-19 17:47     ` Eli Zaretskii
2023-05-20  8:56       ` Mattias Engdegård
2023-09-06 20:10         ` bug#63588: " Stefan Kangas

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

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

  git send-email \
    --in-reply-to=D0DD1925-FF93-44EF-83D4-56E970922F9C@acm.org \
    --to=mattiase@acm.org \
    --cc=63586@debbugs.gnu.org \
    --cc=balducci@units.it \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.