Hacker News new | ask | show | jobs
by dima_vm 1254 days ago
Kotlin has it, but only if the function accepts the function argument, e.g. `foo({println("hello")})` is the same as `foo {println("hello")}` (larger example in my other comment above).

You can also make it on no-args function, if it's a method (attached to a type). Utilizing @get(), like that: `3.mph` and have somewhere else defined

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