Organizing extension functions

I don’t really have a good answer for that. I am pretty much starting from a clean slate so I have all the freedom there is to structure the library in a way I seem fit. These are the reasons why I am thinking about having the implementation logic in separate companion objects:

  1. There will be a lot of extension functions (probably hundreds), and some of them cannot be simple one-liners. Having them as one liners is nice because it is pretty much a list of what is available.
  2. Using extension functions in a scoped way can be useful to use only a subset of them.

But the more I think about it, the more I think that I am probably overthinking and I should just stick with top-level functions in a single file. The benefits of splitting it out into multiple files/companion objects is not worth the added complexity of having nearly identical function definitions in multiple places.

Thad being said: If there was a way to expose by importing (similar to how x becomes available in a Python module when you import x), I would split it up into multiple files, but AFAIK there is no such thing in Kotlin (or Java).