4 ms·
I haven't dealt much with c++ templates but they are fully turing complete. I believe rust generics are weaker and more like java. In c++ templates try to see i
by rat87 13y ago
I haven't dealt much with c++ templates but they are fully turing complete. I believe rust generics are weaker and more like java. In c++ templates try to see if a type can be used in a function. In rust you can only use a function if the type fulfils a trait which seems a lot like generic constraints in java/c#.
I don't think making things explicit is a goal of rust. Making things safe as possible by default while being fas is. A good example is that most local variables are type inferenced rather then declared.
- steveklabnik 13y agoMaking _costs_ explicit is a goal of Rust. Stack allocation is syntactically cheaper than heap allocation, for example.
- fooyc 13y agoSadly, operator overloading is not a really good way of making costs explicit.