Easier derives Tuple equivalent of const generics
Avoid post-monomorphisation errors Be able to take multiple tuples
- cons-list
- Allowing template to to indexing or arbitrary tuples
- Concatenating tuples
- Variadic functions
"Recursive" tuples (like C++ variadics)
"@ .." to reuse existing syntax
https://github.com/fredpointzero/rfcs/blob/variadic_tuples/text/0000-variadic-tuples.md https://github.com/alexanderlinne/rfcs/blob/variadic_generics/text/0000-variadic-generics.md https://github.com/memoryleak47/variadic-generics/blob/master/0000-variadic-generics.md rust-lang/rfcs#376
We have to distinguish between variadic functions and variadic types Generally speaking, existing languages implement variadic functions in one of three fashions:
- Have a special variadic argument at the end of a function. That variadic only handles a single type, and is more of a shorthand for passing a slice (ex: Java, Go, C#).
- Have a special, dynamically-type variadic argument at the end of a function. Usually in dynamically-type languages, this variadic handles different types, but these types can only be differentiated at runtime, with no compile-time validation (ex: C, Python, Javascript).
The thing I'm personally not too enthusiastic about is derives as a big motivation for this. If you wanted to able to inspect all parts of the type the derive was used on like proc-macro derives can, you would basically end up with
const Input: syn::DeriveInputinstead ofconst Name: Stringandconst FieldNames: [String]. The only improvement over proc-macros then would be the ability to declare some assumptions the derive macro has of the input (types of a struct's fields implement a certain trait, maybe some other things), and I would argue that most macros have more complex requirements of their input than that. I think without post-morphization errors, only <5% of what people want derives to do could be done with something like#[variadic_derive], which stands in stark contrast to the effort that would be required to enable it.The issue of proc-macro compile times is also being tackled from other sides (see watt and cargo-watt), which I find a lot more compelling.