Fred Friis
06/26/2023, 7:47 PMCLOVIS
06/26/2023, 9:09 PMsimon.vergauwen
06/27/2023, 7:23 AMWhen context receivers are binary-stable (most likely Kotlin 2.1 or 2.2).Uhm, that is not accurate 🤔 We were thinking when K2 is released at the end of this year. Within the K2 series there should be no binary unstable changes within Kotlin. We think that we can make the switch to context receivers in a binary compat way. I am hoping to release 1.2.0 soon.
CLOVIS
06/27/2023, 7:53 AMsimon.vergauwen
06/27/2023, 7:56 AMcontext(A) () -> B
will be the same JVM signature as A.() -> B
.
APIs with multiple receivers will be new, so they won't be backwards breaking.
Only thing that would be breaking is Raise<None>
for option
, or Raise<Nothing?>
for nullable
, but in those cases it can be done in a binary compat way through a simple deprecation cycle. So that's probably a minor bump, not a major one. And the deprecations would be so simply, it can easily be done with ReplaceWith
. (Only adding imports since it would be source compatible).CLOVIS
06/27/2023, 8:00 AMsimon.vergauwen
06/27/2023, 8:04 AMcontext(A) () -> B
can only be transformed into (A) -> B
on the JVM, I thought that was pretty set in stone 😅 Perhaps suspend context(A) () -> B
can be (A, Continuation) -> Any?
or (Continuation, A) -> Any?
so there it might actually differ 🤔
In such cases we can always leverage DeprecationLevel.HIDDEN
since it would be source-compatible, and then it would remain binary compatible as well. DeprecationLevel.HIDDEN
is one of my favorite compatibility tricks in Kotlin, as long as you stay source compatible you can just replace an entire implementation in a backwards compatible way.CLOVIS
06/27/2023, 8:06 AM@JvmName
but that's a very small price to payCLOVIS
06/27/2023, 8:06 AMsimon.vergauwen
06/27/2023, 8:15 AM@JvmName
🤔CLOVIS
06/27/2023, 8:16 AM@JvmName
is not needed