SE-0283: Tuples conform to Equatable, Comparable, and Hashable

+1 on the utility of the addition.

There have been multiple occasions where I started to use a Tuple for something and then chose against it due to it not being Equatable!

The stated technical debt is my only concern. Should this should be added now or should it be held until it can be implemented natively? The Information needed to develop an educated opinion on this isn't really in the proposal, other than the Author's own opinion on the matter. That information being...

  1. What language features are required for generalized Tuple protocol adherence?
  2. What is the expected timeline of those features?
  3. Would that functionality be confined to that version and newer?

My best, semi-educated guess for #1 is the primary lynchpin is Variadic Generics.
For #2, Since On the road to Swift 6 mentions Variadic generics as a likely feature, and I'm (purely) guessing that will be in the fall 2021 release. I would expect Protocol-adhering extensions for Tuples could then be added either alongside Variadic Generis or the following release if additional features are needed.

So based on that, this would bring the availability of this feature foward by a year or 18 months. Swift has already existed for 6 years without this so IMO introducing non-removable technical debt seems unnecessary for only year of usage.

However, #3 potentially holds a lot of weight. Will a native Swift implementation of this be back-deployable to Swift 5.0 the way this version is? If not, that increases the availability-for-most-users to more like 3 or 4 years, which IMO makes the technical debt more palatable

Is there any more concrete info I'm not taking into consideration?

Also, I'm curious how both of these statements are true

these conformances are being implemented within the runtime which allows us to backward deploy these conformance

and

there is a level of runtime support needed to enable these conformances to work properly. Going forward this means we'll need to keep the entry points needed for these to work even after tuples are able to properly conform to protocols.

If the feature is deployable to any Swift 5+ client's runtime, why does it also need runtime support? (forgive me if I'm missing something obvious. Not a compiler/language engineer :innocent:)

1 Like