[swift-evolution] [Proposal] Set literal and Set type syntax
2th at gmx.de
Tue Jan 19 10:23:28 CST 2016
> Especially since sets are used so infrequently compared to Array and Dictionary.
I guess this is (at least partially) some kind of chicken or the egg problem:
Arrays are easy to declare, so they are often used even if you actually want set characteristics.
If you don't care for indices, and your collection should not contain duplicates, you still can use an array (and there was a time where the situation was even worse - afair Swift 1 had no native set-type).
So, I think propagating the correct use of collection types is good, but there is no natural syntax for sets, and "Set(…)" isn't that bad (I'd rather vote for removing the array-shortcut: Swift lacks the concept of fixed-size arrays, and this would be way more typing than "Set" ;-)
More information about the swift-evolution