5 ms·
> This limitation will probably be sorted out eventually, but it takes time to settle on a design that satisfies everyone and is implementable. That sounds unl
by masklinn 5y ago
> This limitation will probably be sorted out eventually, but it takes time to settle on a design that satisfies everyone and is implementable.
That sounds unlikely, it’s would require not just const generics but some sort of variable arity generics.
If Haskell doesn’t have it, I don’t really see Rust getting it.
- swsieber 5y agoThere have been various variable arity generic discussions on the internals forum (internals.rust-lang.org), but I think it's a significantly lower priority issue than the other stuff in flight. I think we might get it in a few years.
- chrismorgan 5y agoThis is my position, too. I think everyone agrees that we want to get generic tuples, but there are other higher priority issues still, so it’s mostly more a backburner project worth thinking about when designing things, and slowly working towards as good a design as we can come up with which fits in with the rest of the language (including future possibilities) as well as possible. Even in a vacuum it’s not trivial to design something both satisfactory and implementable, and when you add other language features, corners the language has been designed into, and corners you want to avoid painting the language into, it gets much harder still.
- Diggsey 5y agoWhy not? Rust isn't limited to what Haskell does, and a lot of it's features are driven by a desire for parity with C++, which does have variadic generics. Other languages in the same domain (like D) also have variadic generics.
- masklinn 5y agoBecause Rust’s generics are patterned after Haskell’s (traits are dual to type classes), not C++’ templates.
- Diggsey 5y agoYou're conflating traits with generics. Generics exist without traits, and in Rust they are more closely aligned with C++ templates than anything else, since they are implemented via monomorphisation, whereas in Haskell they are not. Regardless, Rust is not "patterned" after a single other language. It's influenced by many langauges, so it makes no sense to say that one feature is just copied straight from a specific other language.
- deleted 5y ago[deleted]