On Tuesday, 17 February 2015 at 20:48:07 UTC, Jonathan Marler wrote:
That would work if you didn't have to unwind the stack but unfortunately you do. The catch block exists in the context of the function it is written in. That means it assumes the stack pointer and stack variables are all in the context of it's defining function. If you executed the catch code when the stack wasn't unwound, then it wouldn't know where any of the variables were. Does that make sense? Think about it for a minute. You proposal suggests that the catch code can be executed no matter how many child functions have been added to the stack. This is impossible since the catch code no longer knows where all of it's stack variables are. Normally it uses an offset to the stack pointer but now it has been changed. That's why you have to unwind the stack.

So the catcher would have to behave like a delegate.

Reply via email to