On Monday, 16 September 2013 at 15:47:36 UTC, ilya-stromberg wrote:
On Monday, 16 September 2013 at 15:12:05 UTC, Maxim Fomin wrote:
On Monday, 16 September 2013 at 10:29:12 UTC, matovitch wrote:
All your examples are great, thank you ! Is there a way to omit validate such that the compiler would call it implicitly ?

For example :

class C {
...
}

void fun(@nonNull C c) {
...
};

C c;
fun(c);  //compilation error since C is null

No, this isn't doable with UDAs because what you want requires runtime check. It is doable using other language features.

It's intresting how can I check that pointer is not null at the compile time. Can you print a example, please? I know that we can use contract programming, but it requires runtime check.

That isn't possible. ;)

Reply via email to