I’ve just tried 1.0.0-beta-4583. While the package refactoring definitely makes it easier to find stuff in stdlib, it also hampers usability. To give just one example, for ((key, value) in myMap)
now gives hard to understand errors until multiple extension methods from kotlin.collections
have been imported, allowing maps to participate in for..in
.
Another example is file.walk().filter { ... }
, which now gives a strange error about accessing a private field filter
, until kotlin.sequences.filter
(not kotlin.collections.filter
!) is imported. Without the help of an IDE, this feels too hard to figure out, and at least for now, IntelliJ does’t suggest the import after the fact.
As a result, two thirds of my files now contain the line import kotlin.collections.*
, and many others import kotlin.text.*
or import kotlin.sequences.*
. My initial impression is that requiring imports for essential functions such as those found in StringsKt
, CollectionsKt
, and MapsKt
goes too far, and that they should be available by default. Perhaps I’ll change my mind over time, but I thought I’d provide early feedback.
PS: I would have preferred the Java convention of uniformly using singular form for package names (collection
, sequence
, etc.), but that’s just my preference.