> There's an open issue for something like this: Variadic generics[1]. But so far every attempt at an RFC has been closed or postponed.
> There's an open issue for something like this: Variadic generics[1]. But so far every attempt at an RFC has been closed or postponed.
I would guess that two big issues for that are lack of function overloading and that macros are pretty good.
A lot of the patterns of working with variadics in c++ take advantage of function overloading. Without function overloading, those patterns can become harder.
Secondly, Rust macro system is crazily powerful especially procedural macros. That power disincentivizes developing other approaches to meta programming. In C++ macros are clunky and dangerous, and that has incentivized developing more type based meta programming techniques to get away from C macros.
fn blah(blah: Blah)
^^^^^^^^^^^^^^^^^^^ the trait bound Method<_, _> is not satisfied
As opposed to something like this with variadic generics: fn blah(blah: Blah)
^^^^ the trait bound ToPolarValue is not satisfiedSadly it hasn't been worked on in years.
Fn(..Args) -> T
which I assume would let the compiler know why the trait bound is not satisfied and output a nicer error message.