Why are context receivers still experimental?

Not sure if it’s still the case, but it’s also said in the release video that it is for JVM only, which is a bit confusing to me, why can’t it “simple” add an additional parameter to the class construction/method invocation when com/transpiling? Im just very confused as to why it is still experimental as it would seem it’s not that hard to implement.

1 Like

Kotlin is a complex language with a lot of intertwining features. Context receivers are still experimental because of both resolution and code generation. For resolution, consider the fact that context receivers interact with lambdas, classes, overload resolution, etc. For code generation, context receivers already have a massive amount of bugs with interfaces and inline methods for instance because it is difficult to change the whole of the compiler codebase to consistently add the additional parameters in one specific position. Thankfully the kotlin team has been doing a great job in squashing those bugs, but there’s still a lot more open (just search context receivers on the Kotlin Youtrack).

Context receivers are very experimental. I am not a part of Kotlin team, but I believe that the design will be somehow changed as well. You can read the discussion at Context receivers · Issue #259 · Kotlin/KEEP · GitHub.