Are uninitialized variables a problem?
in c and similar, the variable space is filled with random or memory data, and may lead to false calculations and corrupt state.
C# and Java use default and null to initialize structs and class-type instance variables.
This partially solves the issue, but programmers still forget to check for null and straight forward code becomes defensive.
null is also an actual valid value, so it's different from the meaning of 'uninitialized'.
I had an idea, to introduce a special symbol, Uninitialized, (or whatever you wanna call it) that is very similar to nil, in that all types can have it, but only the system assigns it, once, and programmers cannot assign this value at all.
it exists just to make sure that you can't read from a variable that has the Uninitialized value. (you won't be able to do anything with it, once you have it)
it can be something like an object variant, or compiler magic.
The user, that is, the developer may not have to have direct contact with this value, as the compiler can issue errors. so it's invisible to the user, and no extra mental burden is required, there is in fact less, because there are less null reference errors.
It seems that it would be easier to implement, and a safer way to handle errors that can occur in runtime.
Obviously I have no idea what it entails in actual effort to implement this.
I was wondering if such an issue was considered before, and what ideas were tossed around.
Thanks!