Why does idiomatic Rust code pervasively parameterize over trait bounds, rather than simply taking trait objects? The speed argument smacks of premature optimization; what are the other reasons?
fwiw I don't necessarily think impl Trait will make this much worse. Generics are already greatly preferred to trait objects culturally in rust.
-
-
Impl trait in input position is just sugar, so it changes nothing. In an output position it avoids boxing is all.
-
It could possibly cause people to "use generics more" but I doubt it will move the needle that much. People use the hell out of generics.
-
The main problem with the "premature optimization" argument is that this kind of stuff is hellishly hard to find out from traces. Inefficient dispatch and similar problems make "peanut butter profiles"; they smear a little bit all over the profile.
-
It helps that this is compile time performance and not runtime perf.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.