| > Rust's users find the module system even more difficult than the borrow checker. I've tried to figure out why, and figure out how to explain it better, for years now. The module system in Rust is conceptually huge, and I feel it needs a 'Rust modules: the good parts' resource to guide people. (1) There are five different ways to use `pub`. That's pretty overwhelming, and in practice I almost never see `pub(in foo)` used. (2) It's possible to have nested modules in a single file, or across multiple files. I almost never see modules with braces, except `mod tests`. (3) It's possible to have either foo.rs or foo/mod.rs. It's also possible to have both foo.rs and foo/bar.rs, which feels inconsistent. (4) `use` order doesn't matter, which can make imports hard to reason about. Here's a silly example: use foo::bar;
use bar::foo; (Huge fan of your writing, by the way!) |
Thank you!