On Sun, 2014-02-02 at 14:45 +1300, Nick Cameron wrote: > - The change adds boilerplate and nomenclature that is likely > unfamiliar to our target audience - 'for all' is well known to > functional programmers, but I believe that is not true for most users > of C++ (or Java). Being closer to the C++/Java syntax for generics is > probably more 'intuitive
So instead of 'for all', use 'template', and we're closer to C++ syntax than ever! template<T: typename, U: typename> struct Foo { ... } template<T: typename, U: typename> impl Trait<T> for Foo<T, U> { ... } template<T: typename, U: typename> fn foo(...) { ... } ;-) fwiw, like C++, Java generic methods also put the <> type parameter list in front of the function signature rather than behind the function name: public static <T extends Comparable<T>> int countGreaterThan(T[] anArray, T elem) { ... } ... while C# apparently compromises and puts the type parameters between the function name and value parameter list, but leaves the bounds for later: public static bool Contains<T>(IEnumerable<T> collection, T item) where T : IComparable<T>; Neither approach translates too well into Rust, but that Rust is almost the odd one out here makes me sympathetic to the desire to avoid breaking up particularly function declarations between the name and the value parameter list too much, in spite of the familiarity argument. Of course, like everything else, that has to be balanced with avoiding superficial but far-reaching overhauls of the language at the eleventh hour. Alas! -benh _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev