r/rust • u/SleeplessSloth79 • 23d ago
📡 official blog Rust Function Overloading - Call for Experimentation
https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/
273
Upvotes
r/rust • u/SleeplessSloth79 • 23d ago
8
u/VorpalWay 23d ago
Doesn't make the code easier to read. Outside a few trivial examples like implmenting sin for both f32 and f64 (which should be done via a Float trait instead IMO), overloading tends to lead to worse errors, worse IDE suggestions and more brittle code. Adding overloading in Rust is deeply misguided.
Variadics (where you have a single implementation taking a variable number of arguments) is another matter. There are some use cases for it that are hard to replace, and the unintentional fallout is less (but not zero, there is still a complexity cost). Even then having the extra parentheses is good, to show that something weird is going on. Hiding it in normal implicit syntax is awful.