[Openmcl-devel] Compiler infinite loop

Pascal J. Bourguignon pjb at informatimago.com
Mon Sep 20 02:04:53 PDT 2010


Gary Byers <gb at clozure.com> writes:

> Having a symbol-macro (or any other kind of macro) expand into itself
> will obviously lead to infinite recursion.  The condition that gets
> raised in some implementations is due to the fact that this infinite
> recursion exhausts the stack (not because they've otherwise tried to
> solve the halting probkem); in other implementations, tail-call
> optimization makes it equivalent to an infinite loop.
>
> I'm not really sympathetic to the notion that - all other things being
> equal - symbol-macroxpansion should consume stack space unnecessarily,
> so that someone who writes an infinitely recursive symbol macro won't
> be "bitten" by that hanging instead of stack overflowing as they (for
> some unknown reason) appear to expect.  I'm much more sympathetic to
> the general idea that deeply recursive things should run in bounded
> stack space if that's at all possible.


Symbol macrolets don't take a parameter.  Their expansions are constant.

For this reason, I think that it would be nice of the implementation
to detect symbol macrolet loops.



There could also be a hidden loop going thru several symbol macrolets,
so the pathological case:

 (symbol-macrolet ((test test)) test)

could actually be:

 (symbol-macrolet ((test another-variable)) test)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/




More information about the Openmcl-devel mailing list