What is the point of nothrow?

Bauss jj_1337 at live.dk
Sun Jun 10 23:59:17 UTC 2018


What is the point of nothrow if it can only detect when Exception 
is thrown and not when Error is thrown?

It seems like the attribute is useless because you can't really 
use it as protection to write bugless, safe code since the nasty 
bugs will pass by just fine.

I'm aware that it's a feature that nothrow can throw Error, but 
it makes the attribute completely useless because you basically 
have no safety to guard against writing code that throws Error.

To an extend @safe works, but there are tons of stuff that throws 
Error which you can only detect and guard against manually.

So what is the point of nothrow when it can only detect 
exceptions you'd catch anyway.

To me it would be so much more useful if you could detect code 
that could possibly throw Error.


More information about the Digitalmars-d-learn mailing list