I want to point out the following bug in the example, because it's *such* a 
common problem and, in my opinion, one of D's warts:

Walter Bright wrote:
>      this(P q)
>      {
>          assert(q);
>          p = q;
>      }

Try
auto d = NotNull!Object(null);

you'll get a segmentation fault and not an assert. That's because 
assert(someclass) does not check if someclass is non-null at all, it 
verifies its invariant instead!

All the asserts should be assert(q !is null);.

Reply via email to