Interfaces + mixins => problem

Tom S h3r3tic at remove.mat.uni.torun.pl
Tue May 2 05:18:02 PDT 2006


IMHO the following code should either fail to compile or produce a 
meaningful result:

----
import std.stdio;


interface Foo {
	template FooImpl() {
		void func();
	}
	mixin FooImpl foo;
}


interface Bar {
	template BarImpl() {
		void func();
	}
	mixin BarImpl bar;
}


class Baz : Foo, Bar {
	static template FooImpl() {
		void func() {
			writefln("FooImpl !");
		}
	}
	mixin FooImpl foo;
	
	
	static template BarImpl() {
		void func() {
			writefln("BarImpl !");
		}
	}
	mixin BarImpl bar;
}


void main() {
	Baz b = new Baz;
	Foo f = b;
	Bar r = b;

	f.func();
	r.func();
}
----


When ran, it prints:
FooImpl !
FooImpl !

It would be really great if it outputed:
FooImpl !
BarImpl !


If that's a problem, id rather it didn't compile at all...
Thanks :)

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O 
!M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------

Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d-bugs mailing list