unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: balducci@units.it, "Stefan Monnier" <monnier@iro.umontreal.ca>,
	"Mattias Engdegård" <mattiase@acm.org>
Cc: 63586@debbugs.gnu.org
Subject: bug#63586: 29.x: dotimes (possible) problem
Date: Fri, 19 May 2023 19:00:13 +0300	[thread overview]
Message-ID: <83ednctipe.fsf@gnu.org> (raw)
In-Reply-To: <4450.1684509068@dschgrazlin2.units.it> (balducci@units.it)

> From: balducci@units.it
> Date: Fri, 19 May 2023 17:10:44 +0200
> 
> the dotimes macro behaves differently in 29.x with respect to previous
> versions
> 
> Basically: 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.
> 
> Here is a minimal stretch of dummy code clarifying the problem I'm
> reporting.
> 
> emacs-29.0.91 (or 29.0.90)
> ==========================
> 
> (dotimes (ii 10)
> (insert (format "%2d " ii))
> (when (= ii 4)(setq ii 11))
> )
> ==>  0  1  2  3  4  5  6  7  8  9 
> 
> emacs-28.2 (or any version <29.x)
> =================================
> 
> (dotimes (ii 10)
> (insert (format "%2d " ii))
> (when (= ii 4)(setq ii 11))
> )
> ==>  0  1  2  3  4 

I can only reproduce the behavior you see in 28.2 in Emacs 26.3.  All
the later versions, starting from 27.1, behave like Emacs 29 does.

> The ability to jump out of the loop by pushing the loop variable over
> the upper limit is something that I happen to use in my scripts, so
> 29.x breaks them somehow
> 
> Of course, there are very many other equivalent ways to
> accomplish the same result, but I don't see why this one
> shouldn't be supported (any longer)
> 
> Is the changed behavior intentional? Am I missing some blatant point here?
> 
> AFAICS, changing the value of the loop variable from inside the loop
> body is supported by any other language which I know about

Adding Stefan and Mattias who made changes in dotimes recently.





  parent reply	other threads:[~2023-05-19 16:00 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
2023-05-19 16:00 ` Eli Zaretskii [this message]
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

  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=83ednctipe.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63586@debbugs.gnu.org \
    --cc=balducci@units.it \
    --cc=mattiase@acm.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 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).