User defined attributes use
simendsjo
simendsjo at gmail.com
Mon Sep 16 12:15:09 PDT 2013
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
As others have noted, the compiler cannot know what any of your
attributes mean.
But you can do this:
class C {
invariant() {
validate(this);
}
}
More information about the Digitalmars-d-learn
mailing list