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: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 65833 <at> debbugs.gnu.org
Subject: bug#65833: 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.