2 ms·
Generic associated types are equally expressive to higher-kinded types while being more straightforward to implement on top of Rust's existing syntax. Adding t
by comex 8y ago
Generic associated types are equally expressive to higher-kinded types while being more straightforward to implement on top of Rust's existing syntax. Adding true higher-kinded types in the future is not out of the question, but you'd need to add new syntax to declare them, which represents a fair bit of complexity for something that may not be necessary.
There are also questions about ambiguities with respect to default parameters. If you have
struct Foo<A = i32>(A);
you can currently write `Foo` to refer to `Foo<i32>`, but what if you meant to refer to the higher-kinded type `Foo` itself? It could be determined based on context, but that would be somewhat confusing, and might not be possible in all situations (like when declaring type aliases, or if a way is ever added for a parameter to accept multiple kinds).