April 04, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2050





------- Comment #9 from sandford@jhu.edu  2009-04-04 09:53 -------
(In reply to comment #0)
This seems to break composability:

interface I1 { final int foo() {return 1;} }
interface I2 { final int foo() {return 2;} }

class A: I1, I2 {}

Whose foo does A choose? And how is it resolved? (given you can't drop one of the interfaces). And consider

class B: I1, I2 { final int foo() {return 3;} }
B b = new B();
I1 i1 = b;
I2 i2 = b;
assert( i1.foo == 1 );
assert( i2.foo == 2 );
assert(  b.foo == 3 );


-- 

April 04, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2050





------- Comment #10 from sandford@jhu.edu  2009-04-04 10:01 -------
(In reply to comment #0)
> Consider:
> 
> interface Foo
> {
>     void bar();
>     final void baz() { bar; bar; }
> }

How is this superior to the current interface + mixin approach? Or an mixin-able interface approach?:

class A:Foo {
    mixin Foo; // Add Foo's final/static method bodies to A
}


-- 

April 04, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2050





------- Comment #11 from andrei@metalanguage.com  2009-04-04 10:58 -------
(In reply to comment #9)
> (In reply to comment #0)
> This seems to break composability:
> 
> interface I1 { final int foo() {return 1;} }
> interface I2 { final int foo() {return 2;} }
> 
> class A: I1, I2 {}
> 
> Whose foo does A choose? And how is it resolved? (given you can't drop one of
> the interfaces).

I think that's an ambiguity. It might be busted by having A write e.g. alias I1.foo foo;

> And consider
> 
> class B: I1, I2 { final int foo() {return 3;} }
> B b = new B();
> I1 i1 = b;
> I2 i2 = b;
> assert( i1.foo == 1 );
> assert( i2.foo == 2 );
> assert(  b.foo == 3 );

A good use of final functions is to enable the non-virtual interface idiom. The point of that idiom is partially that you cannot override final functions in interfaces.


-- 

July 07, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2050


Rob Jacques <sandford@jhu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandford@jhu.edu


--- Comment #12 from Rob Jacques <sandford@jhu.edu> 2010-07-07 07:23:10 PDT ---
Wasn't this added in D 2.040. (i.e. should this be closed?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2050


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


--- Comment #13 from yebblies <yebblies@gmail.com> 2011-06-10 08:49:07 PDT ---
Added in dmd2.040

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »