On 11/01/2013 10:50 AM, Niko Matsakis wrote:
> Anyway, it was proposed on IRC today that we could do something like
> this instead:
>
> fn foo<T:Eq>(..) {...} // One bound is the same
> fn foo<T:(Ord, Eq, Hash)>(...) {...} // Multiple bounds require parentheses
>
> I find this visually appealing. It's easier for my eye to read,
> particularly if the bounds are complicated.
>
> I know it's a syntax change, and we're trying to avoid those, but I
> thought I'd throw it out for a wider audience to ponder, particularly as
> it would eliminate a rather surprising whitespace dependency.
I'm ok with this, and much less fond of solving the ambiguity by adding
whitespace dependency there. IME a multi-trait-bound signature is a bit
of a code smell anyways.
(Incidentally, this sort of thing is exactly why I feel like we need
someone to start formalizing the grammar. It's not really ok to say
"we've frozen the syntax" before we know that the existing grammar is
unambiguous!)
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev