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



--- Comment #3 from jens.k.muel...@gmx.de 2012-03-02 00:35:52 PST ---
(In reply to comment #2)
> (In reply to comment #1)
> > Can you elaborate why the static type must be considered? What's the problem
> > with using the dynamic type?
> 
> The problem is simple. Let's consider a class A and a subclass B.
> 
> Then a function as this :
> 
> void fun(A a) {
>     a.foo();
> }
> 
> If passed an element of type B, fun will work, because B is a subclass of A. 
> If
> B.foo's contract is different than A.foo's, then B.foo's in contract is
> executed.
> 
> It is a bug, because fun has no knowledge weither it manipulate an element of
> type A or an element of type B. It means that fun must respect the in contract
> provided by A.foo, because in other case, it may or may no work, depending on
> how fun in called, which isn't a reliable behavior.

Yesterday I was sleepy and wasn't able to understand it. But even now I fail to
see the issue.
First fun accepts any instance that is of class A or a subclass of A. And
independent of this whenever you call a.foo() all in contracts must be checked
using based on a's dynamic type.

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

Reply via email to