#414 loop expansion: spurious LET twice

closed-fixed
Sam Steingold
clisp (525)
3
2011-03-31
2007-06-05
Jörg Höhle
No

Hi,

Looking at CLISP macroexpansions after my (gensym "NAME-") patches made me discover the following irregularity.

The pattern variable for loop destructuring is bound twice. I don't think the reason for duplication is special tricks with shadowing, I rather believe it's a small bug, producing no known error.

(loop for nil on '(1 2 . 3) count t)
(MACROLET ((LOOP-FINISH NIL (SYSTEM::LOOP-FINISH-ERROR)))
(BLOCK NIL
(LET ((#:PATTERN-6274 NIL)) ; here
(LET ((#:LIST-6273 '(1 2 . 3)))
(PROGN
(LET ((#:PATTERN-6274 NIL)) ; here
(LET ((#:ACCUNUM-VAR-6275 0))
(MACROLET ((LOOP-FINISH NIL '(GO SYSTEM::END-LOOP)))
(TAGBODY SYSTEM::BEGIN-LOOP (WHEN (ATOM #:LIST-6273) (LOOP-FINISH))
(SETQ #:PATTERN-6274 #:LIST-6273)
(PROGN (WHEN T (INCF #:ACCUNUM-VAR-6275)))
(PSETQ #:LIST-6273 (CDR #:LIST-6273)) (GO SYSTEM::BEGIN-LOOP)
SYSTEM::END-LOOP
(MACROLET
((LOOP-FINISH NIL (SYSTEM::LOOP-FINISH-WARN) '(GO SYSTEM::END-LOOP)))
(RETURN-FROM NIL #:ACCUNUM-VAR-6275)))))))))))

Discussion

  • Sam Steingold
    Sam Steingold
    2011-03-31

    thank you for your bug report.
    the bug has been fixed in the source tree (mercurial/hg).
    you can either wait for the next release (recommended)
    or check out the current mercurial tree (see http://clisp.org\)
    and build CLISP from the sources (be advised that between
    releases the source tree is very unstable and may not even build
    on your platform).

     
  • Sam Steingold
    Sam Steingold
    2011-03-31

    • assigned_to: haible --> sds
    • status: open --> open-fixed
     
  • Sam Steingold
    Sam Steingold
    2011-03-31

    • status: open-fixed --> closed-fixed
     
  • Sam Steingold
    Sam Steingold
    2011-08-05

    my "fix" broke
    (loop with nil = (return t) return nil)

     
  • Sam Steingold
    Sam Steingold
    2011-08-05

    fixed differently...