(non)nullable types
Christopher Wright
dhasenan at gmail.com
Thu Feb 12 05:41:54 PST 2009
Jarrett Billingsley wrote:
> Except honestly, the number of cases where you _don't_ want something
> to be null far outweighs the number of cases where you _do_. It's not
> exactly as insidious as the "throws" clause.
I see what you're saying, though I'm certain there is a large minority
of cases in which I do want to allow nulls. I really want to see how
painful it would be to have non-nullable types by default.
There's also the matter of, can I use a nullable variable like a normal
variable? For example:
nullable Foo foo = something;
foo.doStuff();
Brian mentioned having to check if the variable is null before using it.
This would not be easy to implement, and it might be a bit hard to use.
Again, I'd have to see it in use.
While we're talking about hacking the compiler, how about const by
default? :P
More information about the Digitalmars-d
mailing list