[swift-evolution] Synthesizing Equatable, Hashable, and Comparable for tuple types

Xiaodi Wu xiaodi.wu at gmail.com
Sat Nov 25 16:38:06 CST 2017


On Sat, Nov 25, 2017 at 4:30 PM, Mike Kluev <mike.kluev at gmail.com> wrote:

> On 25 November 2017 at 16:04, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>
>>
>> The workaround substantially bloats the standard library, and the result
>> is nothing close to the same because your type is still not Equatable. This
>> means that it cannot benefit from any generic algorithms. For example, an
>> array of such tuples cannot be Equatable in turn.
>>
>>>
>>
> i see. then the current workaround is not deep enough.
>
>
>> speaking of ugliness, the ellipsis on the left of names is quite ugly:
>>>
>>>      extension<...Elements : Equatable> (Elements...) : Equatable
>>>
>>
>> Seems perfectly fine to me.
>>
>
> i haven't encounter this notation before so it looks strange and requires
> some effort to decipher. if it was e.g. in this form:
>
> extension (Equatable...) : Equatable
>
> then it would be immediately obvious what it means, IMHO
>

That reads to me like you are extending a tuple of type `(Equatable...)`.
This is not the same as extending a tuple of type `(E...) where ...E :
Equatable`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171125/cb034e31/attachment.html>


More information about the swift-evolution mailing list