www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4326] New: struct invariants documentation

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4326

           Summary: struct invariants documentation
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I'd like D docs to state that invariants can be used inside structs too (so
putting the explanation of invariants in this page is bad:
http://www.digitalmars.com/d/2.0/class.html#Invariant ).

The documentation about struct invariants also needs to exaplain that the
assert() syntax can't be used to call struct invariants (as it is possible with
class references):


struct Foo {
    int x;
    invariant() { assert(x == 1); }
}
void main() {
    Foo f;
    assert(f); //  Error: expression f of type Foo does not have a boolean
value
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 15 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4326


Leandro Lucarella <llucax gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |llucax gmail.com
         Resolution|                            |DUPLICATE



PDT ---
I think this is a duplicate of bug 3578, please check if there is something
missing in that bug and add it as a comment. Since both bugs are so similar I
don't see a point on having both open so I'm marking it as duplicate.

Please, feel free to correct me if I'm wrong.

*** This issue has been marked as a duplicate of issue 3578 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 21 2010