/* Again, should parse and typecheck, though watch out for constructor * syntax. */ type Point { int x; int y; } type ColorPoint extends Point { int color; } type MovingPoint extends Point { float dx; float dy; } class PtClass() : Point implements Point { init int x; init int y; export Point : x as x, y as y; } class ColorPtClass() : ColorPoint implements Point, ColorPoint { /* We should add syntactic sugar for init fields. */ init int x; init int y; init int color; export Point : x as x, y as y; export ColorPoint : x as x, y as y, color as color; } mixin makeMovingPoint() : MovingPoint at Point impl MovingPoint { init float dx; init float dy; super(); export MovingPoint : x, y, dx, dy; } subclass MvPtCls = makeMovingPoint(PtClass); subclass MvClrPtCls = makeMovingPoint(ColorPtClass); MovingPoint main() { new MvClrPtCls : MovingPoint(x = 3, y = 4, color = 42, dx = 0.4, dy = -3.2); }