[Issue 6856] Preconditions are not inherited

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 26 10:30:21 PST 2012


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



--- Comment #20 from timon.gehr at gmx.ch 2012-02-26 10:30:17 PST ---
(In reply to comment #19)
> (In reply to comment #17)
> > That assumption is bogus, because this is almost never the case.  
> > It makes contract programming basically unusable.  Such a strong 
> > weakening of the 'in' contract should not be the default.
> 
> It depends on how you look at it. 

I look at it in a pragmatic way. Have you ever used the feature in any
language?

> A function can, by default, accept 
> any arguments of the types specified. I think the view taken is that 
> the in contract supplements the parameter list,
> and the absence of an 
> in contract with a given parameter list denotes an absence of further 
> restrictions on what may be passed into the function.
> 

By symmetry, the view would have to be taken that the out contract supplements
the return type. Do you see how that is problematic?

Whatever reason for the current behavior there might be come up with when
thinking hard about it: The current behavior of DMD is not useful, and I refuse
to believe that it is by design. I am not aware of any language that specifies
such non-useful semantics for their contract inheritance.

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


More information about the Digitalmars-d-bugs mailing list