D is dead

Ethan gooberman at gmail.com
Thu Aug 23 23:06:00 UTC 2018


On Thursday, 23 August 2018 at 22:12:17 UTC, David Nadlinger 
wrote:
> Throwing constructors are fundamental for making RAII work in a 
> composable fashion.

Is that actually true, or would handling exceptions within the 
constructor allow one to initialise the object to an invalid 
state and thus still follow RAII paradigms correctly?

The amount of bugs and pain I've had to deal with in production 
code because of throwing constructors makes me lean more towards 
Walter's viewpoint here. Even one of our most basic datatypes - 
the IEEE float - initialises to an invalid state. Why can't RAII 
objects do the same if it performs operations it *knows* throw 
exceptions?


More information about the Digitalmars-d mailing list