On Fri, Mar 11, 2016 at 7:17 PM, Howard Lovatt via swift-evolution
<[email protected]> wrote:
> @Dave, Yes, CollectionType would be better than SequenceType.
We already considered doing this a long time ago, and we decided against it.
1. `for x in y {}` would start working everywhere because of T to T? promotion.
2. Even if we forbid that specific promotion in that context, the following
for x in optionalThing {}
is also not good if the unwrapped value is a collection. (The user
probably meant to iterate over the collection instead.)
3. Why would one want all of the collection APIs on an optional?
index(of:)? sorted()? .first/.last? Another overload of map that
returns an array?
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution