From D Wiki
Jump to: navigation, search

What happens when the need arises to throw in one of the scope(this) blocks? Let's say, I call some system function to release a resource and that fails. Now I want to pass that error on to the application.

1) Are Exceptions disallowed entirely in scope(this)?

2) Will they be wrapped in an (uncatchable) Error? The rationale being that when a destructor cannot complete the program is at least as much in an invalid state as if you ran out of memory. Errors also don't need to care for cleaning up the stack IIRC.

3) Will they be thrown as is and be catchable? In that case what will happen with the rest of the scope(this) statements and more importantly other structs on the stack that need to be destroyed?

I would go with 2 if feasible, otherwise 1. 3 is just an example of how you can design a broken programming language, hehe.