digitalmars.D - Re: null and type safety
- Mike Hearn <mike plan99.net> Nov 28 2008
The basic problem is that it's hard to integrate a language with non- nullable types with libraries written without them (e.g. when auto- generating bindings with BCD). This would likely be a big problem for D, since integrating with existing C and C++ code is a major feature.
Can't that be solved by reversing the syntax, ie, you mark variables that cannot be null rather than variables that can be. The compiler then requires you to prove the non-nullness of the value on that codepath (or cast it away with nonnull). I'd love to see non-null types in D2. Intuitively, it'd catch at compile time quite a few bugs I see in my programs (assuming a strong compiler analysis).
Nov 28 2008