[Issue 6857] Precondition contract checks should be statically bound.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 5 08:57:05 PDT 2012


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



--- Comment #53 from deadalnix <deadalnix at gmail.com> 2012-05-05 08:58:21 PDT ---
(In reply to comment #52)
> (In reply to comment #51)
> > I'm sorry, but this reading can't close the discussion.
> 
> I think it does. The proposed behavior does not allow this:
> 
> "None of this, then, is permitted. But the reverse changes are of course
> legitimate. A redeclaration may weaken the original’s precondition or it may
> strengthen the postcondition. Changes of either kind mean that the subcon-
> tractor does a better job than the original contractor-which there is no reason
> to prohibit."
> 

And indeed, it is not prohibited.

> Doing a better job is succeeding where the parent method would have failed its
> precondition. It all boils down to the fact that it's natural to have methods
> that can't work in the parent but do work in the child.

It is stated (quoting myself) that :
« fizzbuzzB(B b) {
    b.foo(); // (A.foo OR B.foo)'s in contract is valid
} »

Which exactly the behavior you talk about.

-- 
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