[iterate-devel] [Bug] Hashtable traversal code always put at the beginning

Andrea Taverna a.tavs at libero.it
Sun Aug 15 12:58:44 UTC 2010


SYSTEM DESCRIPTION >
Iterate version: latest from darcs repository and 1.4.3
Lisp implementation: SBCL 1.0.33

BUG DESCRIPTION>
when using FOR..IN-HASHTABLE the code generated for hash-table 
traversing is always put at the beginning of generate code, with the 
result that the hash-table to be traversed must be in scope since the 
beginning of the ITER form.

EXAMPLE >

(macroexpand-1 '(iter:iter
     (iter:with table = (make-hash-table))
     (iter:for (k v) in-hashtable table)
     (format t "~A ~A ~%" k v)))
==>
(WITH-HASH-TABLE-ITERATOR (#:HASH-TABLE-ITERATOR-810 TABLE)  ; <-- 
'TABLE used before being bound
   (LET* ((TABLE (MAKE-HASH-TABLE)) (#:G811 NIL) (K NIL) (V NIL))
     (BLOCK NIL
       (TAGBODY
         (PROGN)
        LOOP-TOP-NIL
         (PROGN
          (MULTIPLE-VALUE-SETQ (#:G811 K V) (#:HASH-TABLE-ITERATOR-810))
          (IF (NOT #:G811)
              (GO LOOP-END-NIL))
          (FORMAT T "~A ~A ~%" K V))
         (PROGN)
         (GO LOOP-TOP-NIL)
        LOOP-END-NIL
         (PROGN))
       NIL)))

thank you,

Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/iterate-devel/attachments/20100815/315f6470/attachment.html>


More information about the iterate-devel mailing list