[swift-evolution] [Pitch] Moving where Clauses Out Of Parameter Lists
Timothy Wood
tjw at me.com
Wed Apr 6 13:53:11 CDT 2016
> On Apr 6, 2016, at 11:48 AM, Sean Heber via swift-evolution <swift-evolution at swift.org> wrote:
>
> This almost seems like it could work so that it didn't even need the bracketed parts to be able to figure out the types:
>
> func anyCommonElements(lhs: T, _ rhs: U) -> Bool where
> T : SequenceType,
> U : SequenceType,
> T.Generator.Element: Equatable,
> T.Generator.Element == U.Generator.Element
> {}
>
... though if there are no type constraints, this would be ambiguous:
// If there are no know types T and R in scope, is this an error or are T and R assumed to be unconstrained generic parameters?
func f(arg: T) -> R
-tim
More information about the swift-evolution
mailing list