Closed
Description
I am not sure what the chances are, but if it could be improved, it should be before 1.0.
Rust's module system has a steep learning/doing curve. I think there are two reasons for this:
- Importing functionality and importing namespace are two steps:
mod
anduse
. This leads to the shadowing rules, that have weird consequences: you need to import a path viause
which is not even defined at this point in time, becauseuse
needs to beforemod
. I find this not only unfamiliar but also counterintuitive. - The compiled file becomes a crate. In most languages you can iteratively compose a project of files/modules and use/compile those individually. Since
use
statements are relative to the crate, the meaning changes depending on which file you currently compile. The consequence is that it makes it more difficult than necessary to first write filea.rs
, thenb.rs
(usesa.rs
), and thenc.rs
(usesb.rs
) and make them compile individually. Even in Haskell that is easy. In Rust you either have to go back and forth and adjust theuse
-staments or only put themod
-statements in a dedicated top-level crate (lib.rs
ormain.rs
) which defies encapsulation.
This could be an issue that is fixable with more/better documentation. However, when you need a lot of words/actions to describe/do something in one system which does not need that care in another system, that could be an indication that there is some accidental complexity. I think this complexity is accidental since i am not yet aware of which gains are compensating for this.
Metadata
Metadata
Assignees
Labels
No labels