When you declare lots of extension functions inste...
# announcements
d
When you declare lots of extension functions instead of class members, you end up with very many imports. And extension functions are very common in stdlib,
kotlin.cinterops
for kotlin native,
kotlinx.coroutines
, and most other projects that use a similar style in this respect. I wonder if people would support the idea that importing a type should also import extension functions of that type that reside in the same file or package. This would mean that if you import
CoroutineScope
, you don't need to import
launch
or any other builders other than
runBlocking
. What do you think?
g
You can configure star import threshold in Idea
maybe you could set it to 1 or 2
d
I know, I'm not a fan of doing that
g
So your idea is to import only extension functions explicitly?
g
so, you'll add a lot of explicit imports at once, and Idea will remove them immideattely, because they are not used 😄
e
We always import with
*
in Kotlin libraries. It works great with top-level extension functions
… and with DSLs in general. The idea is that as soon as you something from a package, you’ll like be using a lot more stuff (extensions) from the same package
👍🏻 2