kotlin-unsigned
kotlin-unsigned copied to clipboard
Provide Mutable and Immutable Utypes
Now we can change var v
so even val Utype
is mutable. What about renaming currenty Utypes to MutableUtypes (like in Kotlin Notation) and providing Utypes with val
that will be truly immutable? I will use those immutable classes.
The idea behind is that since they are boxed, in this way it is possible to offer a way to avoid a new instantiation.
The thing I dislike about MutableUtypes
is the verbosity..
What about using instead some read-only interface? A concept that for example is used by joml
I've checked joml
. Have I understood right that they use a letter c
for those immutable interfaces? So the concept is clear for me. It will be great if we have the same logic in the Kotlin Unsigned project.
Now we have to find somebody who will implement it :)
There are experimental unsigned types in Koltin 1.3. And they support immutability via val
... They use new feature called "inline classes" to do this. So I'm going to switch to the official lib. Anyway, thank you for the work.
Yep, thank you for assisting so far :+1:
Ps: I'm also tempted to switch to the lib, but my biggest problem is that unsigned doesnt extend Number
class..
Actually, my biggest problem now is that the lib doesn't provide toDouble()
methods :) I even created an issue: https://youtrack.jetbrains.com/issue/KT-27108 .
Well, you know you can easily implement that here :p
Anyway, I voted your issue, maybe it'll get implemented sooner or later
I see you also mention the Number
inheritance.. actually this might be solved if they change Number
from abstract class to interface, but as they write:
no compelling use cases