What steps will reproduce the problem?
Create an infinitely recursive macro.
defmacro incrloop (i)
print i
template
incrloop ^,(+ 1 (eval i))
call it:
> incrloop 0
What do you see?
...
quote 6578
quote 6579
*** Error - 'Stack Overflow'
'<EagerProc: print>'
'<LazyProcedure: <incrloop>>' 206 'console'
What is the expected output?
The recursive macro continues three times longer than a similar recursive
function such as:
def incrstack (i)
print i
incrstack (+ 1 i)
#~ 2018
#*** Error - 'Stack Overflow'
#'<EagerProc: print>'
#'<EagerProc: <incrstack>>' 181 'console'
However I had expected the macro to evaluate in the environment of the caller,
and hence continue indefinitely. Perhaps macro execution needs to return a
'bubble' object which the higher level must detect and evaluate? Just like the
RefLisp trampolining solution.
But adding a 'bubble' mechanism would give us goto, (recur) like Clojure
amongst other fun ideas. Hmmmm You would need eager and lazy bubbles.
Original issue reported on code.google.com by birchb1...@gmail.com on 4 May 2013 at 5:06
Original issue reported on code.google.com by
birchb1...@gmail.com
on 4 May 2013 at 5:06