Hacker News new | ask | show | jobs
by vips7L 313 days ago
I have wrapped my head around it. I think it's confusing to the reader and creates awkward semantics.
2 comments

Yeah, extension functions are one of those features that went from 'oh, this is nice' to "this is so overused it's counterproductive".

It makes reading a lot of Kotlin source quite terrible.

Lately they've been shoveling a lot of similar magical "code comes from somewhere" features into a language, slowly giving it a C++ clutter type feel.

What I mean by that is this:

   val a: SomeType? = null
   // I’m forced to null check here
   if (a != null) {
       a.someMethodOnIt()
   }
   // But I don’t have to null check here
    a.someExtensionFn()
It’s weird.