[Issue 302] New: in/out contract inheritance yet to be implemented
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Aug 21 02:45:50 PDT 2006
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=302
           Summary: in/out contract inheritance yet to be implemented
           Product: D
           Version: 0.165
          Platform: PC
               URL: http://www.digitalmars.com/d/dbc.html
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: smjg at iname.com
A long-standing unimplemented feature is inheritance of in/out contracts.  From
the spec:
"If a function in a derived class overrides a function in its super class, then
only one of the in contracts of the function and its base functions must be
satisified. Overriding functions then becomes a process of loosening the in 
contracts.
A function without an in contract means that any values of the function
parameters are allowed. This implies that if any function in an inheritance
heirarchy [sic] has no in contract, then in contracts on functions overriding
it have no useful effect.
Conversely, all of the out contracts needs [sic] to be satisified, so
overriding functions becomes a processes of tightening the out contracts."
It's about time we finally got this implemented.  A strategy was proposed at
digitalmars.D:31595, "Implementing contract inheritance".
Existing DStress testcases:
http://dstress.kuehne.cn/run/i/in_out_body_10_A.d
http://dstress.kuehne.cn/norun/i/in_out_body_10_B.d
http://dstress.kuehne.cn/norun/i/in_out_body_10_C.d
http://dstress.kuehne.cn/run/i/in_out_body_11_*.d
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list