43 lines
741 B
Plaintext
43 lines
741 B
Plaintext
import io:*
|
|
import set
|
|
import mem
|
|
|
|
fun runFunc(func: fun():void) {
|
|
func()
|
|
}
|
|
|
|
obj ToClose {
|
|
var data: int
|
|
fun print4() {
|
|
println(4)
|
|
}
|
|
fun testMethod() {
|
|
runFunc(fun() { print4(); } )
|
|
}
|
|
fun testVariable() {
|
|
data = 7
|
|
runFunc(fun() { println(data); } )
|
|
}
|
|
}
|
|
|
|
obj One (Object) {
|
|
fun construct(): *One {
|
|
return this
|
|
}
|
|
fun destruct() {
|
|
var a:One
|
|
mem::safe_recursive_delete(&a, fun(it: *One): set::set<*One> { return set::set(it); } )
|
|
}
|
|
}
|
|
|
|
|
|
fun main():int {
|
|
var it: ToClose
|
|
it.testMethod()
|
|
it.testVariable()
|
|
//var a = 7
|
|
//mem::safe_recursive_delete(&a, fun(it: int*): set::set<int*> { return set::set(it); } )
|
|
return 0
|
|
}
|
|
|