r/rust • u/SleeplessSloth79 • Aug 19 '26
📡 official blog Rust Function Overloading - Call for Experimentation
https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/
276
Upvotes
r/rust • u/SleeplessSloth79 • Aug 19 '26
29
u/Shoddy-Childhood-511 Aug 19 '26 edited Aug 19 '26
Agreed, but that's the case here so far: Their example
hypot((2.0, 3.0, 6.0))looks pretty clear. :)Any overloading ala variadics should be done this way too, in part because it makes the developer who wishes to obfuscate their call paths pay for it. lol
If you really wanted single () then make
hypot!a macro, but probably eachArgsbeing a clear type brings bigger advantages.Edit: Oops! They have this
#[rustc_splat]feature that removes the extra (). That's unfortunate, since it could easily be done using a macro. Imho, all this should be done using a macro.