deviant
06/15/2022, 12:23 PMephemient
06/15/2022, 12:35 PMTheannotation makes it explicit that something special with this class is going on in JVM, and it enables us to support non-annotated value class in the future Valhalla JVM by compiling them using the capabilities of the Project Valhalla.@JvmInline
Why not the reverse? Why not a use a plain value class now, and add somevalue class in the future? The answer is that, so far, Valhalla promises to be the right way to implement value classes on JVM and Kotlin’s key design principle in choosing defaults is such that “the right thing”, the thing that developers will be using most of the time, should correspond to the shorter code. Ultimately, with the Project Valhalla, it will be the right thing to compile a default (non-annotated) value class with Valhalla, so it means that we must require an annotation now, with pre-Valhalla value classes, to avoid breaking changes for stable Kotlin libraries in the future.@Valhalla
deviant
06/15/2022, 12:38 PMdeviant
06/15/2022, 12:39 PMephemient
06/15/2022, 12:41 PMvalue class
in a library compiles to something now and a different thing in the futuredeviant
06/15/2022, 12:43 PMAlan B
06/15/2022, 1:07 PM