Nick06/14/2020, 3:39 AM
Try it out and provide feedback. (edited)
val velocity = 5 * meters / seconds val acceleration = 9 * meters / (seconds * seconds) val time = 1 * minutes // d = vt + ½at² val distance = velocity * time + 1.0/2 * acceleration * time * time println(distance ) // 16500 m println(distance `as` kilometers) // 16.5 km println(distance `as` miles ) // 10.25262467191601 mi println(5 * miles / hours `as` meters / seconds) // 2.2352 m/s
Hamza06/14/2020, 3:39 AM
altavir06/14/2020, 6:12 AM
meaning that you will have boxing performance overhead. My idea was to use inline clases with
passed as a generic and resolved via reflections or comile-time resolution. It seems that that feature could be added without breaking existing code. We can discuss it in #science .
Kroppeb06/14/2020, 7:43 AM
before converting to kilometres and miles?
Nick06/14/2020, 7:56 AM
raulraja06/15/2020, 12:54 PM