I also appreciate how identifiers resolve consistently between imports and terms. However, I have many times been bitten by this behavior in practice.
Making _root_
a keyword won’t solve this problem since I don’t want my source files to look like this
import _root_.a.b
import _root_.c.d
import _root_.e.f
// ... 15 more lines of import _root_.a
For a language that already supports import a.{b, c}
, this feels unsatisfying. Here is an alternative proposal: extend grouped imports to support arbitrary nesting.
import _root_.{
a.b
c.{d => e}
k._
...
}
- backwards compatible, don’t use the feature if you want to cross-build to older scala versions
- natural extension of already existing functionality:
import a.{b, c}
- no overloaded keyword or delimiter semantics
- quality of life improvement for people like myself who prefer fully qualified imports
To complement this change, we can make _root_
a keyword, although I’ve never experienced problems with this in practice.