I don't think you can use inline class w/ basic types.. you also can't add/overload operators w/ inline class (at least not the last time I tried, which was a few versions ago).
TwoClocks
08/03/2021, 5:53 PM
hmm... actually, I think everything I just said is wrong.
TwoClocks
08/03/2021, 5:54 PM
But they can only be immutable, so I'm not sure how to get
+=
to work?
a
Alexis Manin
08/03/2021, 5:59 PM
Look at the playground I attached. It is done in it. However, be careful, because operator overloading in Kotlin is a syntactic sugar for functions, it does not follow math operation priority : https://kotlinlang.org/docs/operator-overloading.html
t
TwoClocks
08/03/2021, 6:30 PM
that'll work. Thanks for the tip on operation order... good to know.
TwoClocks
08/03/2021, 6:31 PM
I'm not on 1.5 yet cuz of a bug in the null
?.
operator. Should be fixed in 1.5.30 though, and
JvmInline
doesn't exist in 1.4.x so I'm a little SOL for now. but thanks!