Walter Bright wrote: > Rainer Deyke wrote: >> Writing an assertion for every non-nullable reference argument for every >> function is tedious. > > It's also quite unnecessary. The hardware will do it for you, and the > debugger will tell you where it is.
You're missing the point. It's not the moment at which the dereference happens that's the problem. As you point out, we have a hardware trap for that. It's when a null *gets assigned* to a variable that isn't ever supposed to *be* null that's the problem. That's when the "asserts up the posterior" issue comes in, because it's the only mechanism we have for defending against this. I need to know when that null gets stored, not when my code trips over it and explodes later down the line. Non-nullable types (or proxy struct or whatever) means the code won't even compile if there's an untested path. And if we do try to assign a null, we get an exception at THAT moment, so we can trace back to find out where it came from. -- Daniel
