On Sat, Feb 1, 2014 at 5:39 PM, Corey Richardson <[email protected]> wrote:
> A deeper, more pedagogical problem, is the mismatch between how `struct
> Foo<...> { ... }` is read and how it is actually treated. The straightforward,
> left-to-right reading says "There is a struct Foo which, given the types ...
> has the members ...".

I read "struct Foo<...> { ... }" the same way as "fn foo(...) -> ...".
 In the latter case, given some value parameters, I get a return
value; in the former, given some type parameters, I get a struct.  On
the contrary, I would find the idea that "forall<T> fn" is specified
with "fn::<T>", like in C++ (template <typename T>) relatively
confusing.

For bulk generics I would rather have the concept of a generic module
than just copy the generic arguments onto each item.  (For that
matter, I think I'd like to have traits on modules or something like
that, so that you can have something like a list trait which comes
with a type for the list and a type for its iterator, without having
to write two generic parameters on everything.  But that's a different
story.)

Also, I think the syntax for generics is verbose enough as it is; I'd
rather see it shortened than lengthened.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to