If you want something that isn't nullable, you'll need a type which which isn't nullable, which means using a struct. I know that you want non-nullable references, but for D2, the best that you're going to get is a struct which
wraps a class.

- Jonathan M Davis

That would be fine if i only have to write:

[code]
void test(NotNullable!Foo f) {
[/code]

and not

[code]
Foo f = new Foo();
NotNullable!Foo nf = f;
test(nf)
[/code]

as well.

This overhead ist the same as if you use precondition. That's the reason why IMO NotNullable as struct isn't a good choice for that situation.

But to overwrite the .init was just an idea, i didn't think that so much guarantees would be broken. Thanks for your explanation.

Reply via email to