(non)nullable types

Nick Sabalausky a at a.a
Tue Feb 17 18:38:14 PST 2009


"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.





More information about the Digitalmars-d mailing list