Yeah, the connotations of “export” are suggestive, but potentially misleading. “Export” implies you’re taking something from inside the module and making it available outside the module. Having to say
pub export to make it actually available outside the module seems like saying “yeah, but now really do it”. On the other hand, saying
export(self) seems like saying “export, but never mind”. I suppose
pub(restricted) already suffers from this problem in general, though.
export is actually doing is bringing a name into the module as an item (as opposed to just
useing it in the module). Items declared in the module are already “exported” (even if they’re not public). So it seems like what you’re really doing is importing, though if Rust had both
use, there’d be no end of confusion about which to use when. “Include” also has more appropriate connotations, but again, people would get confused about when to
include and when to
“Export” might be close enough, though, as long as you liberally interpret “inside” the module to include submodules, and “outside” the module to… also include submodules. I almost want to suggest—as an alternative to mean bringing a name into the module as an item rather than just
useing it—a term which came up near the beginning of this saga:
mount be visible only to submodules but
pub mount be visible publicly would actually make sense, and there’s no risk that people will associate it with the equivalent of
use in another language.
Whether you’d be able to get away with using module relative rather than absolute paths is unclear though. The one benefit of
export implying taking from inside the module (when it really needs to take from anywhere but inside the module) is that it at least makes the fact that it takes module relative paths self evident.
Edit: I’ve talked myself out of the following train of thought, but I’ve left it in for posterity:
Another term that has very close to the right meaning is “alias”. It would also justify using module relative paths instead of absolute paths. The only thing that might be confusing is that people might expect it to be
[ visibility ] "alias" ident "=" path ";"
whereas here we would want it to be
[ visibility ] "alias" path [ "as" ident ] ";"
The other issue I can foresee is people not expecting
alias to be an item, and thus not seeing the distinction from
use. In particular, the
use path as ident would also be referred to as an alias, potentially confusing people. Whereas
mount doesn’t have this problem, since telling people you can
use something under an alias or
mount it under an alias is relatively easy to understand. Also, “mount” has a very clear connotation of installing something for display, so it would never be mistaken as not being an item.