GNU bug report logs - #65833
30.0.50; cl-loop on the intervals uses global var

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 8 Sep 2023 20:58:01 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#65833: closed (Re: bug#65833: 30.0.50; cl-loop on the
 intervals uses global var)
Date: Sat, 09 Sep 2023 02:19:02 +0000
[Message part 1 (text/plain, inline)]
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 65833 <at> debbugs.gnu.org.

-- 
65833: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65833
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: help-debbugs <at> gnu.org (GNU bug Tracking System)
Cc: 65833-done <at> debbugs.gnu.org
Subject: Re: bug#65833: 30.0.50; cl-loop on the intervals uses global var
Date: Fri, 08 Sep 2023 22:18:29 -0400
I pushed a fix for it to `master`.


        Stefan


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; cl-loop on the intervals uses global var
Date: Fri, 08 Sep 2023 16:57:18 -0400
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




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

Previous Next


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