rtsketo
10/05/2021, 6:41 AMpercent
.
How should a variable that's from 0 to 1 be called?mzgreen
10/05/2021, 7:00 AMfraction
?mzgreen
10/05/2021, 7:01 AMlouiscad
10/05/2021, 7:05 AMxxxRatio
Klitos Kyriacou
10/05/2021, 8:11 AMpercent
- it should be called somethingPercent
or percentSomething
depending on what that "something" represents. However, percent
would be a good name for a @JvmInline value class
.louiscad
10/05/2021, 8:12 AMPercentage
would be even better for a value class IMO.Matteo Mirk
10/05/2021, 10:46 AMTomasz Krakowiak
10/05/2021, 2:24 PMTomasz Krakowiak
10/05/2021, 2:29 PMvalue class Fraction(
/** Value in range [0,1] */
val value : Double
)
val lookingForMyMeaning : Fraction
Tomasz Krakowiak
10/05/2021, 2:38 PMKlitos Kyriacou
10/05/2021, 2:43 PMrtsketo
10/05/2021, 3:06 PMdpWidth
and pxWidth
. There are always the option of annotations or wrapper classes, but isn't that the easiest way? Same goes for the percentage (as it is a form of unit, %).