Why did Kotlin choose value class/inline class to ...
# random
j
Why did Kotlin choose value class/inline class to implement
Result
instead of normal sealed class and data class inheritance?
c
Not sure if that's the case but inline classes can be used to avoid overhead due to additional heap allocations
today i learned 1
m
Yeah, performance.
Result
is used in a lot of hot coroutines code. Always creating a real Java object would incur significant overhead.
🙏 1
today i learned 1