Comment

Comment by dima_vm

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

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton