(non)nullable types

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Feb 11 14:39:41 PST 2009


On Wed, Feb 11, 2009 at 5:23 PM, Christopher Wright <dhasenan at gmail.com> wrote:
> Or add an invariant. You know which field is null when it shouldn't be, so
> that should be simple enough. Or use a property rather than a field and add
> a contract.
>
> This covers the same cases that non-nullable types do, though admittedly
> with slightly less granularity.
>
> A complex datastructure might have a complex initialization process that is
> best spread across a few lines of code rather than happening all at once. If
> that is the case, you *can't* use non-nullable types, because that
> restriction isn't valid until the object is fully initialized. But you can
> still use contracts here.

What is your response to the part of my post that was cut off?  You
know, the part about having to write stupid contracts and how the
compiler can and should be checking this kind of thing?



More information about the Digitalmars-d mailing list