[Issue 18757] static invariant{} should either work or not be valid syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 16 14:46:31 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18757

--- Comment #4 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to uplink.coder from comment #3)
> Well invariants cannot apply to static methods since they are only concerned
> about the object's state.
> which by definition cannot be directly touched in static functions.
> that's why it's not called.
> 
> I don't see that there is a basis to issue a warning.

What about object that have static fields? If you have a static function which
modify static fields? I would argue that an invariant might want to check
whether a static function has modified the state of the object.

--


More information about the Digitalmars-d-bugs mailing list