This is one of those where I keep hoping someone will pick it up and get the 
proposal out there.

-- E

> On Apr 29, 2016, at 8:57 AM, David Hart via swift-evolution 
> <[email protected]> wrote:
> 
> What’s up with this great idea? Can’t see a proposal on swift-evolution 
> anywhere.
> 
>> On 08 Apr 2016, at 08:15, Chris Lattner via swift-evolution 
>> <[email protected]> wrote:
>> 
>> 
>>> On Apr 6, 2016, at 11:30 AM, Developer via swift-evolution 
>>> <[email protected]> wrote:
>>> 
>>> If you've ever gotten to the point where you have a sufficiently generic 
>>> interface to a thing and you need to constrain it, possibly in an 
>>> extension, maybe for a generic free function or operator, you know what a 
>>> pain the syntax can be for these kinds of operations.  For example, the 
>>> Swift book implements this example to motivate where clauses
>>> 
>>> func anyCommonElements <T: SequenceType, U: SequenceType where 
>>> T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element> 
>>> (lhs: T, _ rhs: U) -> Bool
>>> 
>>> This is noisy and uncomfortable to my eyes, and almost impossible to align 
>>> correctly.  Per a short discussion on Twitter with Joe Groff and Erica 
>>> Sadun, I'd like so see what the community feels about moving the where 
>>> clause out of the angle brackets.  So that example becomes
>>> 
>>> func anyCommonElements <T: SequenceType, U: SequenceType>
>>> where T.Generator.Element: Equatable, T.Generator.Element == 
>>> U.Generator.Element
>>> (lhs: T, _ rhs: U) -> Bool
>>> 
>>> Or, if you're feeling ambitious, even
>>> 
>>> func anyCommonElements <T, U>
>>> where T : SequenceType, U : SequenceType,
>>> T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element
>>> (lhs: T, _ rhs: U) -> Bool
>>> 
>>> Thoughts?
>> 
>> +1, long overdue.  Please keep basic constraints (ones expressible without a 
>> ‘where’ clause, like simple conformances) inline though.
>> 
>> -Chris
>> _______________________________________________
>> swift-evolution mailing list
>> [email protected]
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to