Unreachable statement, do or do not, there is no try
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 10 19:49:06 PST 2015
On Tuesday, February 10, 2015 12:36:50 Walter Bright via Digitalmars-d wrote:
> On 2/9/2015 11:07 PM, deadalnix wrote:
> > On Tuesday, 10 February 2015 at 07:01:18 UTC, Jacob Carlborg wrote:
> >> DMD will complain about the second example if warnings are enabled.
> >
> > Ok I think that answer the question.
>
> The thing is, you can still catch an Object, so catching Exception won't quite
> catch them all.
Wait, what? I thought that something had to be a Throwable to be throwable
or catchable. Allowing any Object to be thrown/caught stinks of the C++
nonsense of allowing _anything_ to be thrown/caught. It's slightly better,
because it's restricted to Objects and stuff like arrays and ints wouldn't
count, but it would still be pretty horrible to be throwing Objects that
aren't intended to be used as exception types. And anything that isn't
derived from Exception being thrown could result in cleanup code not being
run. If something other than a Throwable can currently be thrown, I would
hope that we'd fix it so that that's no longer the case.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list