3 ms·
Rust sacrifices modularity for performance. You're going to have to clone everything if you want to follow along with rust. Additionally you have to use generi
by Herval_freire 4y ago
Rust sacrifices modularity for performance. You're going to have to clone everything if you want to follow along with rust.
Additionally you have to use generics and trait bounds extensively for some equivalent function in rust.
- synergy20 4y agoisn't rust said to be good for high performance? it's also move by default instead of copy, that saves memory copies which is a good thing? I'm lost in 'clone everything', not a rust programmer per se.
- Herval_freire 4y agoYes. one of the things rust sacrifices for high performance is modularity. Rust is a better language for safety and high performance, however it is not the best language in terms of modularity. Haskell takes the crown for modularity and safety but as a result it is less performant then rust. Move by default is not modular. Why? Because it is a mutation. The state of your program changes after a move and your program must be structured around that. That variable that was moved can no longer be reused in the same context so your program is less modular as a result as the definition of modularity is high reusability of modules. Clone just means pass by copy. Make a copy and then pass the value. Pass by immutable reference works too. Just keep everything immutable for maximum modularity. But if you want to mutate things and keep things relatively modular then pass by copy (aka clone) is the best alternative. All in all rust is typically harder to program for and harder to make elegant because of all the anti-modularity features used to increase performance and safety.
- lillywastaken 4y agoThough Haskell's module system is somewhat a wart of the language, and I say this as someone who loves Haskell. "Hierarchical" modules in Haskell2010 are literally just modules with periods in the name, and it lacks the power of ML and Agda's parameterized modules. The other major wart with Haskell to me is the record types.