The reason is for DSLs. It leads to a simpler (more fluent) coding in DSL-heavy apps. The heuristic here is when you use one thing from a package, you’ll like to use more (give that things are properly split into packages), which is especially true for libraries that follow Kotlin-style design and prefer extensions over members.
As a bonus, you get fewer conflicts during merge (though IDEA’s “magic wand” in 3-way merge window is super-helpful)
e
enleur
11/19/2018, 9:24 PM
I see it’s used on all kotlin libs, but why is it not included in official code style?
e
elizarov
11/19/2018, 9:25 PM
Is anything related to imports is included into official code style?
e
enleur
11/19/2018, 9:26 PM
that’s why i’m asking 🙂
e
elizarov
11/19/2018, 9:28 PM
I am not sure it is of any importance for inclusion into an official style guide. Moreover, it might be really a project-dependent choice. For example, for beginners it might be easier to read code when imports are explicit and in some case they help during code review for those people who do it often in GitHub (I, for one, almost always load PRs into IDEA for review. I’m a heavy Ctrl-clicker)
👍 1
g
gildor
11/21/2018, 5:15 AM
Support of Github PRs is coming to Idea 2018.3, really want to use this, it will significantly simplify our workflow, reviewing on GH web is very tedious thing