Mehrdad wrote:
Note to Walter:
You're obviously correct that you can make an arbitrarily
complex program to make it too difficult for the compiler to
enforce initialization, the way C# does (and gives up in some
cases).
[ ... ]
I think some here are mis-interpreting Walters position
concerning static analysis from our earlier conversation, so I'll
share my impression of his thoughts.
I can't speak for Walter, of course, but I'm pretty sure that
early on in our conversation he agreed that having the compiler
catch local scope initialization issues was a good idea, or at
least, wasn't a bad one (again, correct me if I'm wrong). I doubt
he would be adverse to eventually having DMD perform this sort of
static analysis to help developers, though I doubt it's a high
priority for him.
The majority of the conversation after that was concerning
struct/class fields defaults:
class Foo
{
float x; // I think this should be 0.0f
// Walter thinks it should be NaN
}
In this situation static analysis can't help catch issues, and
we're forced to rely on a default value of some kind. Both Walter
and I have stated our opinion's reasoning previously, so I won't
repeat them here.