bob
12/12/2017, 7:31 AMtypealias
to that explicit typealias
. Even if the compiler later removes all type aliases they could (and should?) first be enforced.
typealias Degree = Double
typealias Radian = Double
fun Degree.toRadian():Radian = // Implementation
fun Radian.toDegree():Degree = // Implementation
fun run(degree:Degree) {
// should only be able to call toRadian and not toDegree on this parameter.
degree.toDegree()
}
gildor
12/12/2017, 7:38 AMlouiscad
12/12/2017, 8:37 AMrrader
12/12/2017, 9:47 AMnewtype
will solve this casegildor
12/12/2017, 9:52 AMbob
12/12/2017, 9:54 AMnewtype
in any documentation and can’t use it in my android project..gildor
12/12/2017, 9:58 AMnewtype
is just proposalgildor
12/12/2017, 10:52 AM