I don’t mind the import .com.example.foo
syntax in itself, but to me one important property of any alternate syntax for _root_
is for it to play well when used in expressions and not just imports. e.g. println(_root_.fansi.Color.Red("blah"))
.
I use libraries fully-qualified all the time: utest.assert(...)
, fansi.Str(...)
, scala.collection.mutable.Blah
, java.lang.Double.doubleFromIntBits
, etc… If I’m only using things from a package in one place within a file, I use it fully-qualified rather than importing it 1000 lines up and then using the short name (and possibly shadowing some other short name I want to keep, e.g. java.lang.Double
shadowing scala.Double
, or having to pick some mangled name to avoid that like JDouble
)
A leading .
seems like it would cause parsing problems, e.g. "hello" + .fansi.Color.Red("world")
that would prevent such usage, although I may be mistaken and maybe it’s possible to change the parser around to make it work in a clear/unambiguous way?