What is throwable

Sean Kelly sean at invisibleduck.org
Thu Mar 19 13:44:51 PDT 2009


== Quote from Don (nospam at nospam.com)'s article
> Andrei Alexandrescu wrote:
> > Denis Koroskin wrote:
> >> On Thu, 19 Mar 2009 19:39:52 +0300, Andrei Alexandrescu
> >> <SeeWebsiteForEmail at erdani.org> 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.



More information about the Digitalmars-d mailing list