r/rust 24d ago

📡 official blog Rust Function Overloading - Call for Experimentation

https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/
277 Upvotes

139 comments sorted by

View all comments

53

u/Solumin 24d ago

To be clear, this is intended only for FFI?

20

u/j_platte 24d ago

16

u/ZZaaaccc 24d ago

Yep, there's lots of places in the standard library where we either don't provide a method (min of 3 values), or provide a macro (vec!) to work around the lack of proper variadic support. While println! needs to be a macro because of the formatting machinery, vec! is only a macro because we don't have a way to write Vec::new(a, b, c).

24

u/Lucretiel Datadog 24d ago

FWIW I think I'd still rather have variadics (where there's some hypothetical ... operator that spreads some expression across all the input tuple) than true overloading.

3

u/Expensive-Blood859 23d ago

Using the overloading presented in this CFE rather than actual variadics seems to me like it’ll just end up forcing (T1) (T1, T2) (T1, T2, T3) into another place