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

36 lines
557 B
Plaintext

type t {
void m();
}
class A():t { // no implements necessary
t state = null;
void m() {
state = (this : t); // do we need coercions here? -- yes!
}
export t : m;
}
type s <: t { }
type u {
void m();
}
subclass B():s extends A at t implements u {
super();
// use of m somewhere
void m2() {
m();
}
// .: the type of this is s
// .: the assignment of state = this still works
// because s is below t
export s : m;
export u : m2 as m;
}
void main() {
u x = new B:u();
x.m();
}