When calling this `sortedBy` inline function from ...
# compose
m
When calling this
sortedBy
inline function from a Composable context, why is the selector lambda not also in a Composable context?
Copy code
// in a composable context
items.sortedBy {
    // not in a composable context
    ...
}
As a workaround, I suppose I should build a map of these lambda values and then refer to the map from within the lambda.
r
Even though it's inlined the type of the lambda is not @Composable
m
Thanks Romain. IIRC this is different from suspend functions in that the lambda arg does not need to be declared as a suspend function?
r
Folks like @jim can give you better answers than I can. But I wouldn't be surprised if it's because of where inlining happens (afaik before K2 it's done at the bytecode level)
👍 1
m
I guess it’s related to
crossinline
because there is no such problem with
map
or
associateWith
s
Yeah, we support inlining, but not crossinlining, since that can escape composable context Technically, if suspend lambdas support that, Compose likely should too, feel free to file a bug
👍 2
m
I just checked, and it’s the same (as composable) for suspending lambdas. So no need to file an issue.