What is the point of nothrow?

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 12 14:15:42 UTC 2018


On 6/11/18 5:23 PM, Jonathan M Davis wrote:
> On Monday, June 11, 2018 20:45:52 Dave Jones via Digitalmars-d-learn wrote:
>> So the only solution I could figure is to catch throwable in the
>> callback function, dump the message, and then PostQuitMessage(0).
>> It just seems retarded that Throwables can still happen in a
>> nothrow function.
> 
> Well, it stems from the fact that Exceptions and Throwables are essentially
> different things but use essentially the same error-reporting mechanism. In
> a way, it make sense (especially in the case where you're dealing with a
> single thread that D controls), but I'm inclined to think that it was
> ultimately a mistake.

I agree that the fact you can catch throwables is a mistake, but at the 
same time, there are Errors thrown for things that shouldn't be Errors 
(like RangeError). This forces you to deal with them in places where it 
shouldn't be necessary.

I predict at some point when Errors actually don't do proper cleanup, it 
is going to be a really difficult time for D.

-Steve


More information about the Digitalmars-d-learn mailing list