Subject: bug#65833: closed (Re: bug#65833: 30.0.50; cl-loop on the intervals uses global var)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 09 Sep 2023 02:19:02 +0000

Your bug report

#65833: 30.0.50; cl-loop on the intervals uses global var

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
65833: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65833
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#65833: 30.0.50; cl-loop on the intervals uses global var
From: Stefan Monnier <[email-masked]>
To: [email-masked] (GNU bug Tracking System)
Cc: [email-masked]
Date: Fri, 08 Sep 2023 22:18:29 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

I pushed a fix for it to `master`.

        Stefan

Subject: 30.0.50; cl-loop on the intervals uses global var
From: Stefan Monnier <[email-masked]>
To: [email-masked]
Date: Fri, 08 Sep 2023 16:57:18 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Package: Emacs
Version: 30.0.50

    ELISP> (macroexpand '(cl-loop for X being the intervals of B do
                           (FOO)))
    (cl--block-wrapper
     (catch '--cl-block-nil--
       (cl-block --cl-finish--
         (cl--map-intervals
          (lambda (--cl-var1-- --cl-var2--)
            (setq X (cons --cl-var1-- --cl-var2--))
            (FOO))
          B nil nil nil))
       nil))

As you can see, this sets fails to declare `X` as being a local
variable, so it will affect `X` from the surrounding context.

This looping form doesn't exist in Common Lisp, but `for X being` never
behaves like that, so this is clearly a bug.

        Stefan