On Friday, 17 January 2014 at 07:35:00 UTC, Marco Leise wrote:
void foo(Object o) { if (o !is null) { bar(o); } }
My current NotNull draft allows this: http://arsdnet.net/dcode/notnull.d int b; int* bp = &b; if(auto a = bp.checkNull) { static assert(is(typeof(a == NotNull!(int*)))); } else { assert(0); }So the type of bp doesn't change like it might when built into the language but since we can do if(auto a = ...) it is pretty close.
Thanks to Andrej Mitrovic for the checkNull code.