"Extension types" for Kotlin

To mitigate the implicit problem:

  • don’t allow chaining the conversions
  • force the extension types to be declared at the top level; much of the chagrin of Scala conversions it’s hard to know where they came from
  • (maybe?) in the same spirit, force the extension types to be imported explicitly (not included in wildcards) (*)
  • and (of course), mark extension types conversion clearly in the IDE

I’d still be useful and would place the system well into the “not surprising” territory.

I guess all this stuff really belong in a KEEP, no?

(*) Actually a much better solution would be to make the import system smart, and some syntax to toggle wildcard import of extension types on and off (off by default). It’s a bit unorthodox, but a good compromise (also see this).

3 Likes