http://d.puremagic.com/issues/show_bug.cgi?id=10404

           Summary: Class!T should be the class version of type T
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Andrei Alexandrescu <[email protected]> 2013-06-18 07:39:05 
PDT ---
Given a struct S with state and methods, Class!S should be a type that:

* is a class type
* contains exactly one member, having type S
* has constructors that forward to S's constructors
* has the same methods as S, with implementations that forward to the member's
methods

This offers an immediate means to convert a struct into a class that has the
same functionality but typical class semantics (heap allocation, reference
semantics, overridable methods etc).

Further ideas:

* define a clone() method that duplicates the state by copying the S member
* allow S to be a primitive type
* offer flags such as "all methods should be overridable" or "all methods
should be final", i.e. Class!(S, ClassOptions.allOverridable) vs. Class!(S,
ClassOptions.allFinal).

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

Reply via email to