did i just imagine tuples were going to be hashable in swift 4?


(David Baraff) #1

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.


(Adrian Zubarev) #2

Welcome to the group of people who thinks that the character from Monopoly had a monocle, including myself. You've just experienced a transdimensional jump from your universe without even notecing, but where Swift 4 actually had hashable tuples. :slight_smile:

Jokes aside, I haven't read anything about it in this universe, at least not for Swift 4.

···

--
Adrian Zubarev
Sent with Airmail

Am 7. Juli 2017 um 04:40:55, David Baraff via swift-users (swift-users@swift.org(mailto:swift-users@swift.org)) schrieb:

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.

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


(Vladimir) #3

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.

···

On 07.07.2017 5:50, David Baraff via swift-users wrote:

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