y
01/26/2023, 5:16 AMList<Foo>
, is it always passed by copy? if so, is there a way to make it hold a reference?gildor
01/26/2023, 6:13 AMy
01/26/2023, 6:20 AMgildor
01/26/2023, 6:27 AMephemient
01/26/2023, 6:59 AMfun counter(): () -> Int {
var x: Int = 0
return { x++ }
}
val f = counter()
check(f() == 0)
check(f() == 1)
// etc.