3 ms·
I've never liked default constructors when it produces something that is not representable without executing code. D does not have default constructors. What on
by WalterBright 2y ago
I've never liked default constructors when it produces something that is not representable without executing code. D does not have default constructors. What one does is specify the statically initialized field values (or leave the fields to be set to their statically initialized value). I.e. it has a default initializer.
What this means in practice is one never is presented with an uninitialized or partially initialized struct. A non-default constructor gets handed a default initialized struct to start with. This makes for more reliable software. (Double initialization can be removed by the optimizer.)
Why D doesn't have default constructors gets brought up now and then, as it is an unusual choice.