[iterate-devel] walk-special-forms first (was Iterate broken on A CL 7.0 beta?)

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Fri Nov 12 15:52:41 UTC 2004


Hi,

walking through the archives, I came across this thread.

Indeed, I believe Allegro 7.0 to be broken to macroexpand (cond ...) into (cond ...) again. But Iterate-1.0.9 is IMHO broken as well.

I recommend doing the following steps:
1. if operator is in *special-form-alist*, call handling function
2. if macro-function, tail-recursively expand it
3. if still special-operator-p, complain (and possibly default to function call)
4. if clause, handle it
5. else function call

Rationale: The argument "To make maintenance of ITERATE easier, I prefer expanded macros over special forms that I have to treat specially." is IMHO moot.
Iterate MUST recognize and handle the known special forms, because that's what can come out of macroexpansion.
So it may as well do it immediately.
This has the additional benefit that it can handle these consistently across platforms.

For the sake of Allegro, walk-cond form must remain, otherwise it'll loop endlessly. I expect no other platform specific hacks.

My claim of "portable behaviour" is backed by this observation:
In CLISP, declare behaves as a macro and expands to NIL. I can't judge whether this is bogus, weird or not.
As a result, walk-declare is never called. This explains why declarations are not kept in the code as the manual claims when using CLISP with iterate-1.0.9. 

Only when Iterate treats known special forms first can it guarantee that its walkers will be used. Changing the order to do so makes declarations show up in CLISP.

Handling known special operators first is what iterate-1.0.lisp and -1.2.lisp did.

Steps 3 and 4 are interchangeable, as a matter of taste.

Regard,
	Jörg Höhle




More information about the iterate-devel mailing list