Summary: invariant should be checked at the beginning and end
                    of protected functions
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD


class A
    invariant() { ... }
    public void f() { ... }
    protected void g() { ... }

Currently invariant is called at the beginning and end of each public function,
the end of the constructor, and the beginning of the destructor. Scott Meyers
pointed out to a quite known fact - protected is much closer to public than to
private in terms of offering access control. This is because anyone can just
inherit from a class and call protected methods, or even wrap them in public

Consequently, it looks like the invariant of a class must also hold upon entry
and exit of all protected methods.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to