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.
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.
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.