On Tuesday, 17 February 2015 at 19:03:49 UTC, Chris Williams wrote:
Every throwable function call could be assumed to have a typed result (even void functions) and if, after the return, the caller checks the type and detects that it was an error, bubbles that up, then eventually you get to wherever the catcher is.

But so basically, the current ABI doesn't support it and there's no desire to change it? How do exceptions currently happen, if not via some official ABI declaration of how throwable methods interact with one another? The compiler/linker determines where the catcher is and inserts code to cut down the stack and perform a long jump all the way back? If so, how do scope statements work?

No problem. in fact this kind of solution is a good fit for language where try blocks are rare (say OCaml for instance) as you can unwind much faster, while keeping the cost on the fast path small.

But that wouldn't be a good fit for D (or even worse for C++) because you have unwinding going on (destructor, scope statements, ...) which makes for a lot of implicit try blocks.

Reply via email to