Do we really need extern


This is going to seem a little bit stupid I am sure. I understand that extern does something specific. But wouldn’t it not be possible to wrap it functionality up with use.

extern seem to load an external library, while use can bind a specific point in the path. I would thin you could combine them so you can just write use lib::mod. If it isn’t loaded then the compiler just loads it. Or have the compiler autoload libraries found in a certain directory and the cargo build system could handle downloading the dependencies. If not using cargo load the libraries in the root of the src file being compiled or something like that

I guess it isn’t a big deal. It just seems like a good amount of extra code as it seems every extern has at least 1 if not more use's. Because everyone like shorter paths.


extern crate, you mean? It’s something that has been discussed in the past, numerous times (though I don’t have time to dig up links), and this design continues to be the most explicit, straightforward, and flexible.


Yes I was referring to extern crate. I suppose if it has been discussed already then there was a reason to keep it.

I can work with it, just for me it seems like extra syntax.


The distinction between use and extern crate seems important to me. Crate bindings (extern crate) are very few in number, and large in semantic impact. Crate bindings apply to the entire current crate. But use bindings apply to the current module, not the entire crate, and use bindings are related only to identifying names in this and other creates.

I think combining these two different concepts into a single syntax would be confusing and misleading.