AW: [iterate-devel] bug report - shadowing & lexical environment

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Fri Aug 10 08:06:45 UTC 2007


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



More information about the iterate-devel mailing list