Hacker News new | ask | show | jobs
by dima_vm 1254 days ago
You can make that in Kotlin, e.g.: `3.mph` or `(-45..45).deg` for ranges.

with definition like:

    val Double.mph: Speed
      get() = Speed.mph(this)

    data class Speed(val ms: Double)
      companion object {
        fun mph(mph: Double) = Speed(mph * 1609.344 / 3600.0)
      }