miha-x64
01/16/2017, 10:49 AMfun getSomething() = cached { computeSomething() }
where cached
is an inline function. It is compiled into something similar to
fun getSomething(): Whatever {
val fromCache = cache.get(”something”)
if (fromCache != null) return fromCache
val computed = computeSomething() // inlined lambda
cache.put(”something”, computed)
return computed
}
according to method’s body (not shown)