36 ms·
Yes, the analysis is called definite assignment analysis: https://en.wikipedia.org/wiki/Definite_assignment_analysis https://en.wikipedia.org/wiki/Definite_assi
by sanxiyn 8y ago
Yes, the analysis is called definite assignment analysis: https://en.wikipedia.org/wiki/Definite_assignment_analysis https://en.wikipedia.org/wiki/Definite_assignment_analysis
It was a great victory of Java and C# to require this. Java's analysis is "buggy" and C#'s is complete.
- twic 8y agoTo be clear, buggy in that it can sometimes not detect correct assignment, and require you to add some unnecessary assignments to shut it up. Not in that you can ever read an uninitialised variable. That is a bit of a theme in Java. The type inference often has the same problem. (Although the type inference is also actually unsound)
- kqr 8y agoHub, is that supposed to not be the case with C#? Because I've definitely had that experience at least once, of knowing a variable is initialized and the compiler not "getting" it until I added some semantically redundant formality.