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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 4 14:12:39 PDT 2012


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



--- Comment #37 from Walter Bright <bugzilla at digitalmars.com> 2012-05-04 14:13:50 PDT ---
(In reply to comment #36)
> (In reply to comment #35)
> <snip>
> > Again, this is NOT true. The type of the argument is not statically 
> > A, it is a polymorphic type A.
> 
> Why do you consider the contracts of a method to be NOT part of the API? 

This is not what I am considering. I am saying that A is a polymorphic type,
not a static type. The contracts that apply depend on the runtime polymorphic
type, not the static type.


> Because Bertrand considers it so, or for some other reason?

I am not using argument by authority. Meyer explains it quite well, step by
step, in his book I recommended to you. The behavior is an inevitable
consequence of the fundamental principles of OOP. That is why it is not a
matter of opinion.


> > If an instance of A is passed, then the call to foo(-1) will fail. 
> > Please try it and see for yourself.
> 
> I never doubted that.

Then I am lost as to what you think is broken in the design.

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