4 ms·
Any time you see traits going impl Trait for (T1) impl Trait for (T1, T2) impl Trait for (T1, T2, T3) ... And bunch of macro invocations in the b
by Ygg2 3y ago
Any time you see traits going
impl Trait for (T1)
impl Trait for (T1, T2)
impl Trait for (T1, T2, T3)
...
And bunch of macro invocations in the body on (T1), (T1, T2), etc.
Someone, somewhere cursed there weren't variadics there.
- kolektiv 3y agoI'm writing a library at the moment with exactly this kind of issue (not quite that formulation, but morally equivalent). The whole thing would be a lot simpler (and remove the need for procedural macros to generate all of the types and impls) with variadic generics. Would I use variadic generics regularly? Probably not. But in places where they'd be useful - boy, would they really be useful!
- dathinab 3y agoalso some probably isn't good at using macros because you can make that a single macro which kinda is a bit like variadics. Through it still is limited to some specific number of your size (typical 16 or 32). Anyway not having varadic generics by itself is in most cases just a small inconvenience with limited benefits and there are many far more important priorities IMHO. The main benefit for varadic generics is that they might unblock some other improvements on top of them.