[swift-users] did i just imagine tuples were going to be hashable in swift 4?

Vladimir.S svabox at gmail.com
Fri Jul 7 05:54:46 CDT 2017


On 07.07.2017 5:50, David Baraff via swift-users wrote:
> I thought I read that tuples would finally be hashable in swift 4, allowing for them to be used in dictionaries/sets, but now that i google for it, i find no mention of it.
> 
> are there any plans?  so often i just want to quickly create a dictionary set from a tuple of an integer or string or two, and not being able to do so is just plain annoying.

Here what I can find regarding your question:
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170313/033858.html

--- quote ---
...
 > Btw, what is your opinion, can we expect (at some point of time) 
Equatable&Hashable for tuples?
 > It is very handy to have Dictionary<Tuple<type1,type2>, type3> in C# and sad that 
we can't have [(type1,type2):type3] in Swift without declaration of new temporary 
struct type and implement Equatable&Hashable for it.

It would be reasonable, IMO, even before we support the full generalization of 
extensions on non-nominal types, to make tuples of Equatable/Hashable/Comparable 
elements conform to the same protocols by fiat.

-Joe
--- quote ---

So... it seems like we all (including core team) want this, but this will not be 
implemented in Swift4, as I understand.

> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
> 


More information about the swift-users mailing list