3 ms·
There is one giant issue with Rust crates vs modules, and it's not "crates are harder to make." The real problem is that you can't use crates to improve increm
by duped 3y ago
There is one giant issue with Rust crates vs modules, and it's not "crates are harder to make."
The real problem is that you can't use crates to improve incrementalism when you have a type in one logical part of the module hierarchy implement a trait from another logical part. Due to orphan rules and coherence, it is not possible to implement a foreign trait for a foreign type.
And that said, just because the compilation unit is a crate doesn't mean it can't be compiled incrementally or with parallelism. That's a separate problem.
- rnestler 3y ago> The real problem is that you can't use crates to improve incrementalism when you have a type in one logical part of the module hierarchy implement a trait from another logical part. Due to orphan rules and coherence, it is not possible to implement a foreign trait for a foreign type. Well you can implement a trait for a type from another logical part either in the crate of the trait or the crate of the type. What is the use-case for implementing a foreign trait for a foreign type if you have both under control?