import simple_print:* obj test_cons(Object) { fun construct(): *test_cons { println("construct") } fun copy_construct(other: *test_cons) { println("copy_construct") } fun destruct() { println("destruct") } fun operator=(other: test_cons) { println("=") } fun do() { println("do") } } fun call(it: ref T) { it.do() } fun byRef(it: ref T) { it = it + 1 } fun byRef(it: * int) { *it = *it + 1 } fun byRef(it: ref int) { it = it + 1 } fun id(it: ref int): ref int { return it } fun id(it: ref T): ref T { return it } // what about cosures closing over references? fun main():int { var a = 6 byRef(a) println(a) byRef(&a) println(a) id(a) = 14 println(a) var b = 6.7 byRef(b) println(b) var t.construct() : test_cons call(t) id(t).do() var do_copy = id(t) do_copy.do() return 0 }