|
|
|
|
|
by karmakaze
1322 days ago
|
|
Typescript seems to have no problem with it (nor do I suspect F#/OCaml): class A {
x = 10;
scale(n: number): void {
this.x *= n;
}
}
class B {
y = 10;
scale(n: number): void {
this.y *= n;
}
}
var z: A | B;
z = new A
z.scale(2);
z = new B
z.scale(2);
I was also looking for Sum Types/anonymous enums[0].[0] https://news.ycombinator.com/threads?id=karmakaze&next=33505... |
|