Which statement about the interaction between context receivers and inline classes in Kotlin is most accurate?
Android interview question for Advanced practice.
Answer
Inline classes used as a context receiver can potentially improve performance by reducing object creation, but this is compiler-dependent.
Explanation
The correct answer is C because inline classes, when used effectively as a context receiver, can reduce object creation overhead. The compiler can potentially optimize away the creation of these wrapper objects, leading to performance gains. However, this optimization is not guaranteed in all scenarios and may vary depending on the compiler version and the surrounding code.