On 13.05.2011 10:25, Don wrote: > Are you talking about *finalizers* or *destructors* ?
Destructors as defined in D spec. There are no finalizers (yet), AFAIK. > Throwing from inside a destructor should definitely work (unlike C++). How? Destructor is called by the GC when object is deleted. When and where (which thread) this happens is unknown, it is done outside of regular flow of execution - so who and where can catch this exception? So, like any other uncatched exception, it will terminate the program. > But finalizers should probably be nothrow. Once they are implemented :) In any case, as long as there is no try/catch around GC collection, I see little use for exceptions apart from terminating the program. If, however, we are talking about using try/catch blocks inside of destructors - then of course, this should be possible. /Alexander
