top | item 34283100

(no title)

dima_vm | 3 years 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)

discuss

order

No comments yet.