#22 Mixin implementation

brian Fri 30 Dec 2005

Given the following Fan code:

mixin A { Str a() { return "a" } }
mixin B { Str b() { return "b" } }
class C mixin A, B {}

Would emit the following Java code:

interface A { Str a(); }
class A$ { static Str a(A self) { return "a"; } }

interface B { Str b(); }
class B$ { static Str b(B self) { return "b"; } }

class C implements A, B
{
  Str a() { return A$.a(this); }
  Str b() { return B$.b(this); }
}

Login or Signup to reply.