[Issue 1076] by using scope(exit) tail recursion ain't working

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 21 11:03:41 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1076





------- Comment #1 from davidl at 126.com  2007-03-21 13:03 -------
actually i have an idea of how to implement tail recursion with scope .

err the idea here is simple, when tail recursion , just loop to the point
after SEH structure has been pushed on the stack. coz we are tail recursion
the same func, the SEH structure except the next SEH structure part are the
same as the SEH structure we have now pushed on the stack.

1. if an exception the current func doesn't handle, then throwing it directly
to the caller wouldn't be a problem, coz it would be thrown by the os
recursively

2. if an exception in the current func is actually handled, then in the
handler,
which get called from our OS, would simply do its job, after execution of its
handler func , then back to continue tail recursion not return here.

it's quite a rough thought.
but i think it's possible to have scope() stuff support tail recursion


-- 



More information about the Digitalmars-d-bugs mailing list