My coworker Erica just filed a really interesting ...
# announcements
j
My coworker Erica just filed a really interesting issue if anybody feels like checking it out:
g
Really strange code. What is expected result? This code sets new lick listener on each iteration, so the latest listener will of course close MAX value
k
i compiles to an IntRef
What!? No,
i
has type
Int
, there are no references in Kotlin.
g
@karelpeeters IntRef is exist in Kotlin, it’s just way to pass int by reference to lambda, but it’s just implementation details in bytecode, it’s not clear for me what code from this example tries to do
k
Interesting, didn't know that. From the frontend perspective you'll never have to deal with it/think about it, right?
g
Yes, of course. Java doesn’t support closures of non-final variables, but Kotlin allows to do that and wraps such variable to reference wrapper
👍 1
You can check my comment on this issue, there is just wrong usage of closures, no need to think about IntRef