On Mon, 23 Apr 2012 09:14:12 +0200, Namespace <rswhi...@googlemail.com>
wrote:
I made several tests with NotNull yesterday and actually they all passed.
In special cases i didn't get a compiler error but then a runtime error
is better then nothing. :)
But there is still my problem with this:
void foo(NotNull!(Foo) n) {
}
void bar(Foo n) {
}
in my optinion it must exist a way that both
NotNull!(Foo) nf = new Foo();
foo(nf);
bar(nf);
and furhtermore
Foo f = new Foo();
foo(f);
bar(f);
compiles.
We need some hack, implicit cast or compiler cast that cast or passes
Foo to NotNull!(Foo).
Any suggestions?
No. The whole point of NotNull is that it should enforce not being null.
Allowing implicit casting from PossiblyNull to NotNull would break this.