Paste: clay interfaces
Author: | j |
Mode: | text |
Date: | Sat, 24 Apr 2010 08:22:32 |
Plain Text |
overloadable zim;
overloadable zang;
zim(x:Int, y:Int) : Int = x + y;
zang(x:Double, y:Double, z:Double) : Double = x + y + z;
zim(x:String, y:Int) : Int = y * 2;
zang(x:String, y:Double, z:Double) : Double = y - z;
static TestInterface = Interface[
Tuple[zim, Int, Int],
Tuple[zang, Double, Double, Double],
];
frob(x:Box[TestInterface]) = x.zim(Int(x.zang(2.0, 3.0)));
main() {
x = box(TestInterface, 3);
y = box(TestInterface, "foo");
println(frob(x));
println(frob(y));
}
New Annotation