Btw, why Kotlin has its own `object EmptyList`? Th...
# stdlib
m
Btw, why Kotlin has its own
object EmptyList
? There are already
Collections.emptyList()
and `List.of()`…
s
Collections.emptyList()
doesn’t exist outside of the jvm
List.of()
is only in Java 9 and newer
m
doesn’t exist outside of the jvm
If course, but stdlib has many MPP expect/actual declarations including
listOf(T) = singletonList(t)
is only in Java 9 and newer
Yep, the point is just that there's too many duplication already.
j
This is on my list of things to fix. It's small, but wasteful. I see it in every Android app.
1
m
on my list of things to fix
You mean, rewrite it with R8?
j
No. Fix the stdlib to expect/actual the function and move that impl to JS and native only.
👍 2
Or we could just write a kotlinc intrinsic which rewrite calls to listOf() to Collections.emptyList() and let R8/ProGuard remove the now-unused object
m
a kotlinc intrinsic
actual inline fun
would be enough
j
Send 'em a PR. I won't get to it for a while.
m
Oh... IDEA dies dramatically on just 10kLoC Kotlin project, let's see what will happen on Kotlin itself.
1.5 hours passed. CPU load has gone, Gradle build still pretends to be running. Looks like my contribution is postponed till some next IDEA version 🤷‍♂️