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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 3 11:55:34 PDT 2012


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



--- Comment #16 from Don <clugdbug at yahoo.com.au> 2012-05-03 11:56:47 PDT ---
(In reply to comment #15)
> fizbuzzA(A a) {
>     a.foo(); // A.foo's in contract is valid
> }
> 
> If an instance of B is passed to fizbuzzA, then the a.foo() will call B.foo(),
> and either A.foo's in contract or B.foo's in contract must be valid.
> 
> There is no error or invalid corner case here.
> 
> I suspect that you think the contracts are checked based on static typing -
> they are not, they are done using the virtual type.

This is the issue. WHY are they done based on the virtual type?

Checking the contracts based on static typing would detect logical errors in
the calling code. Doing it based on the virtual type ignores latent bugs in
specific instances where they are harmless. I can't understand why that's a
good idea.

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