Davio
10/14/2023, 9:51 AMvalue class MyInt(val value : Int)
val actualInt: Int = MyInt(1)
Joffrey
10/14/2023, 10:13 AMDavio
10/14/2023, 10:49 AMrealInt = myInt.value
into realInt = myInt
Joffrey
10/14/2023, 10:51 AMDavio
10/14/2023, 11:02 AMJoffrey
10/14/2023, 12:04 PMAmount
class representing money, abstracting away the multiplatform big decimal type. All necessary operations are defined on it, but I don't want the value to be exposed so I can swap the underlying type as needed. And also I want to make sure operations are done in a certain way, and that we can't do it directly on the big decimal. Only formatting operations and a lossy conversion to Double
(for use in charts) are exposed. And of course using this type separates it from pure "fractions" or "rates", which are similarly backed by big decimals..value
. I believe accessing the inner value should be rare enough when using value typesDavio
10/14/2023, 2:33 PMJoffrey
10/14/2023, 8:41 PM.value
.
And if you don't want logs to distinguish this type from the wrapped type, you could override toString
, which doesn't require accessing .value
from the outsideLoney Chou
10/14/2023, 11:59 PMDavio
10/15/2023, 9:39 AM