Why joinToString and joinTo are not inline?


#1

Currently all implementations of joinToString and joinTo are not inline and produces classes when used with callback.
Are any reasons for not make this functions inline?


#2

They produce a lot of bytecode when being inlined.


#3

Why this is problem?


#4

To some extent it’s a problem, especially for methods with many optional parameters, see these issues: https://youtrack.jetbrains.com/issue/KT-12497 and https://youtrack.jetbrains.com/issue/KT-10848.


#5

I think see your point: inlining these functions may broke code because of bugs in Kotlin inlining.
Understood, thank you.


#6

These are performance problems, not bugs. They result in more bytecode than necessary being inlined, however it doesn’t break the code.