[OT] - C++ exceptions are becoming more and more problematic

rikki cattermole rikki at cattermole.co.nz
Wed Feb 23 17:07:40 UTC 2022


On 24/02/2022 6:02 AM, H. S. Teoh wrote:
> Yeah, this is just another variation on Java's checked exceptions, which
> experience has proven is not worth the trouble, because people find it
> too cumbersome and either don't use it or just slap on boilerplate like
> `throws(Exception)` just to make the compiler shut up, which defeats the
> whole purpose.

Not quite.

You don't have to write @throws in the majority. It would be inferred 
automatically (only function pointers).

How it is represented in the AST and how the di generator will generate 
code should be simple like this. But most developers shouldn't have to 
touch the attribute even for the main function.

So in practice this should be more similar to our experience with 
nothrow and @safe/trusted/system rather than Java's.


More information about the Digitalmars-d mailing list