racket/collects/honu/examples/old/mixin-init.honu
Stevie Strickland 7dbb99d3c6 merged 292:296 from branches/sstrickl
svn: r297
2005-07-02 04:03:02 +00:00

32 lines
475 B
Plaintext

/* should parse & type check. */
type T
{
int x;
int y;
int get_x();
}
class BaseCls() : T impl T
{
init int x;
init int y;
int get_x() { x; }
export T : x, y, get_x;
}
mixin mx() : T at T impl T with int x
{
init int z;
super(x = 3);
export T : z as x, y as y, get_x as get_x;
}
subclass DerivedCls = mx(BaseCls);
int main() {
T t = new DerivedCls : T (y = 4, z = 5);
t.get_x() + t.x + t.y; // should evaluate to 12
}