Thu, 19 Mar 2009 20:44:51 +0000 (UTC), Sean Kelly wrote: > == Quote from Don ([email protected])'s article >> Andrei Alexandrescu wrote: >>> Denis Koroskin wrote: >>>> On Thu, 19 Mar 2009 19:39:52 +0300, Andrei Alexandrescu >>>> <[email protected]> wrote: >>>> >>>>> Ary Borenszweig wrote: >>>>>> Andrei Alexandrescu wrote: >>>>>>> Anyhow, we should implement a model in D that allows such multiple >>>>>>> throws. >>>>>> What for? >>>>> >>>>> For allowing destructors to throw. >>>>> >>>>> Andrei >>>> >>>> Are you sure this is sound? >>> >>> Yes. The notion that throwing destructors should terminate the >>> application pronto is a prejudice we got from C++. >>> >>> Andrei >> And it causes lots of problems, in my experience. Since it usually >> doesn't terminate the app, just the thread with the defective >> destructor. Which is unnecessarily difficult to debug. > > I've considered letting the user supply a custom "unhandled > exception" handler for threads. It just seemed messy given that > calling join() on a thread now will rethrow the unhandled exception > if there was one. I figured that the user would join threads he cared > about, and if one he didn't care about terminated unexpectedly the > perhaps that's not a problem.
The problem is when you have a worker thread which never terminates and sends notifications to the main thread. Like game logic thread versus main GUI thread. If logic thread throws, your game suddenly stops working for no apparent reason.
