12/05/2021, 10:44 AM
I was playing around with the new Duration API and I like the 100.days type of extensions. But I noticed that the “.days” type of extensions on numbers are now all defined at the companion object level. From a notebook usage this requires a lot of extra imports if I want to use several of these extensions. Is there a work around for this (I really like to keep imports in a notebook for my users to minimum).

Ilya Muradyan

12/05/2021, 11:03 AM
You can't use declarations without imports, that's how Kotlin works. But obviously you can make these imports implicit for users if you declare them in the integration class/descriptor of your library. Does it work for you?


12/05/2021, 11:06 AM
Thanks, but I was more hinting on the fact that wildcard imports don’t work at companion object level. And although wildcards may be bad practice for regular source code, for notebooks they are often convenient.
👍 1
But I can indeed always include them by default in the integration class.