Marcin Wisniowski
11/23/2021, 11:35 PMStephan Schroeder
11/24/2021, 8:03 AM@JvmInline value class T(val value: Whatever)
should only box Whatever
in rare cases like having a List<T>
. My guess is that you're hitting one of those cases where boxing has always happened. If you think something is off, please provide us with a codesnipped where T is boxed, and we can check if boxing is to be expected or not.
https://typealias.com/guides/inline-classes-and-autoboxing/
(current value classes used to be called inline classes, so this article should still apply)Marcin Wisniowski
11/28/2021, 12:07 PMStephan Schroeder
11/29/2021, 7:42 AMInside
and Outside
implement different interfaces that this couldn't be replicated with extension functions 🤔
Do you just wonder out of curiousity, or do you have a usecase in mind?Marcin Wisniowski
11/29/2021, 12:23 PMOffset(x: Float, y: Float)
value class which packs the two floats into a Long as part of Compose UI. I need a similar Point
class, with different methods, but the same underlying behavior. So I need a different name and a different set of methods for an existing value class. I could of course just copy the source code of Offset
into my project, but I'd like to avoid that.