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



--- Comment #7 from timon.g...@gmx.ch 2012-03-09 14:35:05 PST ---
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > From that follows (given two types A,B and B <: A):
> > > B delegate(immutable(A)) <: A delegate(inout(A))
> > > 
> > 
> > No, it does not. This is not sound.
> > 
> > class A{immutable(A) get(){return null;}}
> > class B:A{
> >     immutable(A) other;
> >     this(immutable(A) other){this.other = other;}
> >     override immutable(A) get(){return other;}
> > }
> > 
> > A delegate(inout(A)) dg = (immutable(A) a) => new B(a);
> > A a = new A;
> > A x=dg(a);
> > immutable(A) b = x.get();
> > 
> > // now a is mutable, b is immutable and (a is b).
> 
> Your example is unsound (no offense :)

Obviously it is unsound. That is the point.

> 
> You can't do:
> A delegate(inout(A)) dg = (immutable(A) a) => new B(a);

You claimed I could.

Boskop wrote:
> B delegate(immutable(A)) <: A delegate(inout(A))

> and neither:
> void function(inout(int)*) wfp = function(int*)(*p = 1;} // as you did in
> comment 2 of bug 7542
> 

I know that both of those should not compile. They were specifically
constructed to demonstrate why certain subtyping relationships do not hold. I
suggest you to carefully read the relevant posts again.

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

Reply via email to