inline fun defaultCheck(result: VkResult) = result.check()
fun bar(check: (VkResult) -> Unit = ::defaultCheck) {
check(..)
}
would there be any allocation regarding passing the lambda to
bar
?
d
Dominaezzz
12/20/2019, 9:28 AM
Iirc, yes.
e
elect
12/20/2019, 11:10 AM
Where?
d
Dominaezzz
12/20/2019, 12:23 PM
Depends on the platform, jdk7 would require the usual Java style anonymous class which can be cached if there are no captures. Jdk8 is a bit more complicated I think, with invoke dynamic. TL;DR lambdas that capture are not free.