Improving the UI of generics

I personally don't think that using the "generic protocols" for multi-parameter protocols is a good idea, since IMO the generic notation is the "good syntax", but multi-parameter protocols without a functional dependency are not the common case. Furthermore, the generics syntax implies an asymmetric relationship between Self and the arguments, which is appropriate for associated types, but completely artificial for multi-parameter protocols. I like the idea of a tuple-ish syntax like early versions of Rust had:

protocol (A, B): Protocol { }

func foo<A, B>() where (A, B): Protocol

or an application-like syntax similar to what's been proposed for Go 2:

protocol Protocol(A, B) { }

func foo<A, B>() where Protocol(A, B)

Since the set of protocols that need to be modeled this way is the minority, I think it's OK for it to have a somewhat more obscure syntax, if we ever support it at all.

4 Likes