Support URI/Java-form crate names

In my opinion, one of the things Rust does better than Java w.r.t. ergonomics is the omission of URLs in e.g. import statements. I am actively happy with the status quo.

The main reason is that import URLs are unreasonably unergonomic to type, a akin to a git dependency. The difference between the 2 is that use statements are used much more than dependency entries in Cargo.toml. In effect, I consider URLs in import statements a usability hazard. It might not.bother those using IDEs that automatically do imports as much, but that is definitely not close to 100% of the community.

In addition, the rest of the URL other than the crate name is just noise. That is to say, it conveys no information that is useful at the level of the program to either me as the author /reader of the code, or to rustc. For example, at the level of code I don't care where it comes from, just that it is unambiguously resolved when I import it. And that is one thing the status quo is exceedingly good at.

And if it did convey useful information, conceptually speaking I think its place would be where all metadata for a crate lives: in its Cargo.toml.

The third reason is the use of strings. Stringly typed language constructs always make me uneasy, it feels way too unsafe. It's the same issue as in any random program in a statically types language, except magnified because it's part of the core language. Note that it is also a usability hazard in this way: strings don't get e.g. syntax coloring or internal error checking other than basic "does this match a reasonable regex for a URL?"

9 Likes