Rust's Huge Compilation Units
11–19 of 19 posts
Re: Rust's Huge Compilation Units
#12The URL of this article was changed to the following (so the one linked on Hacker News as of when I posted this comment is now a 404). https://pingcap.com/blog/Rust-s-Huge-Compilation-Units
Re: Rust's Huge Compilation Units
#13>In my experience though projects tend to start in a single crate, without great attention to their internal dependency graph, and once compilation time becomes an issue, they have already created a spaghetti dependency graph that is difficult to refactor into smaller crates. This happened to me too. One important problem to overcome is the orphan rule. This means: you can only implement a trait you own or for a type…
Funny how, I believe, the terms "orphan" and "newtype" originated in Haskell and were carried over to Rust. Evidence of the functional programming heritage that Rust has, I guess.
Re: Rust's Huge Compilation Units
#14>In my experience though projects tend to start in a single crate, without great attention to their internal dependency graph, and once compilation time becomes an issue, they have already created a spaghetti dependency graph that is difficult to refactor into smaller crates. This happened to me too. One important problem to overcome is the orphan rule. This means: you can only implement a trait you own or for a type…
Re: Rust's Huge Compilation Units
#15The URL of this article was changed to the following (so the one linked on Hacker News as of when I posted this comment is now a 404). https://pingcap.com/blog/Rust-s-Huge-Compilation-Units
Re: Rust's Huge Compilation Units
#16Its not just a Rust problem, I've run into the same thing in Java and I'm sure it exists elsewhere. The only answer I can come up with is to keep your app cleanly divided into modules. There's some cognitive overhead but its usually worthwhile. I recently divided a 100k line Java app into 5 different modules and it compiles 4 times faster. The new boundaries have encouraged better code as well. Suddenly we have thing…
I work with both Java and Rust. Definitely not the same. With Java, you decide what you want to compile with your build script. You don't need to compile entire application as a single unit. If you have to recompile a lot of code when you only make small modification it is likely because did not use many of available ways to just recompile the classes that you modified. Also, with Java some optimizations are pushed t…
Re: Rust's Huge Compilation Units
#17>In my experience though projects tend to start in a single crate, without great attention to their internal dependency graph, and once compilation time becomes an issue, they have already created a spaghetti dependency graph that is difficult to refactor into smaller crates. This happened to me too. One important problem to overcome is the orphan rule. This means: you can only implement a trait you own or for a type…
I find it hard to believe that there exists no set of import declarations which remove all ambiguity, i.e., allowing orphan traits but requiring that they get imported explicitly.
Re: Rust's Huge Compilation Units
#18>In my experience though projects tend to start in a single crate, without great attention to their internal dependency graph, and once compilation time becomes an issue, they have already created a spaghetti dependency graph that is difficult to refactor into smaller crates. This happened to me too. One important problem to overcome is the orphan rule. This means: you can only implement a trait you own or for a type…
I agree. Something must absolutely be done about the orphan rules, IMO they are Rust's biggest wart. They damage composition in a fundamental way, and gimp the otherwise extremely expressive trait system. I find it hard to believe that there exists no set of import declarations which remove all ambiguity, i.e., allowing orphan traits but requiring that they get imported explicitly.
> I find it hard to believe [...]
I think you should read up stuff about the orphan rule, then you will understand better.
Re: Rust's Huge Compilation Units
#19Earlier quoted context omitted.
I agree. Something must absolutely be done about the orphan rules, IMO they are Rust's biggest wart. They damage composition in a fundamental way, and gimp the otherwise extremely expressive trait system. I find it hard to believe that there exists no set of import declarations which remove all ambiguity, i.e., allowing orphan traits but requiring that they get imported explicitly.
I think this is a fundamentally difficult problem. Life is sometimes not nice and you have to choose. I chose to write newtype wrappers and to accept the complexity. > I find it hard to believe [...] I think you should read up stuff about the orphan rule, then you will understand better.