allow full module paths without import? #1996
amitu
started this conversation in
Ideas & RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Rust code I avoid the
use
statements, as that makes reading slightly harder (you have to look at a symbol somewhere in the middle of a file, and then jump to top of the file, to see where is that symbol imported from, or you command click, look at the file/package name in nav bar, and come back).In Rust not using
use
is an option. But it is not possible right now infastn
, and animport
is compulsory if you want to refer to anything not belonging to current module.We can not do:
path separator
In Rust
::
is used as path / folder separator, not/
. We use/
. Slash is better as it lets paths be URLs, so copy pasting the package name is quick way to read docs of the corresponding module.module to symbol separator
In Rust the module to symbol separator is also
::
. We use.
. If we use#
as the separator, we can get further deep linking advantage:Now both
foo.com/bar#baz
andfoo.com/bar#yo
are URLs, and opening either can take you right at the definition of that symbol.import alias to symbol separator
If we explicitly add an import statement we can continue to use
.
as separator for module name alias , and the symbol.Beta Was this translation helpful? Give feedback.
All reactions