GNU bug report logs - #63586
29.x: dotimes (possible) problem

Previous Next

Package: emacs;

Reported by: balducci <at> units.it

Date: Fri, 19 May 2023 15:12:02 UTC

Severity: normal

Merged with 63588

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattiase <at> acm.org>
To: balducci <at> units.it
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>, 63586 <at> debbugs.gnu.org
Subject: bug#63586: 29.x: dotimes (possible) problem
Date: Fri, 19 May 2023 17:54:48 +0200
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.






This bug report was last modified 1 year and 253 days ago.

Previous Next


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