![](https://secure.gravatar.com/avatar/2f7ec3b37425cf4e077e7ef376e451be.jpg?s=120&d=mm&r=g)
Hi, Larry D'Anna wrote:
(defmacro foo () ''macro) (iter (for i from 1 to 1) (labels ((foo () 'labels)) (return (foo)))) returns MACRO, not LABELS
This is a known bug & problem area. It has to do with code walkers inability to interact with the lexical environment in a proper & standardized way. All code walkers implement heuristics that work more or less well, depending on their purpose (IMHO a code-walker for XREF is easier than for Iterate, because XREF need not rewrite the code). Allegro published an environment interface, but I've seen no deep discussion of it, only heard opinions (mostly about lack of suitability for other implementations). Alas, Iterate's design depends on a code walker. E.g. it needs to know that somewhere deep inside the body, there's a COLLECT clause, so that it can prepare appropriate variables. Other designs, e.g. LOOP or Scheme's eager comprehensions (SRFIxy) do not depend on a code walker. But then they reinvent control structure like WHEN, UNLESS, AND, :if etc. Is there some particular standard code which you met which results in the above problem? E.g. Iterate already special cases ignore-errors (for simplicity) and handler-bind (on CLISP). I've wondered here and then whether it should special-case CALL-NEXT-METHOD, as it might be problematic in some implementations (somebody probably has yet to write a method involving call-next-method within Iterate). Regards, Jorg Hohle