(non)nullable types

Christopher Wright dhasenan at gmail.com
Tue Feb 17 19:11:27 PST 2009


Nick Sabalausky wrote:
> "Christopher Wright" <dhasenan at gmail.com> wrote in message 
> news:gnfgj6$1484$2 at digitalmars.com...
>> One possible change: implicit casting with an assertion that the nullable 
>> value is not null.
> 
> I can tell right now I wouldn't like that. That would make it far too easy 
> to make mistakes, as it would open up a way for mistakes to circumvent the 
> whole point of having non-nullables. If I accidentially tried to provide a 
> nullable to something that expected a non-nullable, I'd want some sort of 
> up-front notice so that I can either fix it or confirm "yes, I really did 
> mean that" rather than have to hope that I'm lucky enough for the value to 
> actually be null when I test it. An implicit cast should either "just work" 
> with no risk of runtime-error, or be disallowed in favor of something more 
> explicit.

I think I favor this, actually. If you don't care, you can cast 
manually. But the implementation difference should be miniscule.



More information about the Digitalmars-d mailing list