[swift-evolution] [Idea] Add AssociativeCollectionType to represent Dictionary-type relationships (was: Add an (Index, Element) sequence to CollectionType)

Dave Abrahams dabrahams at apple.com
Thu Dec 31 21:39:24 CST 2015


> On Dec 31, 2015, at 6:09 PM, David Waite <david at alkaline-solutions.com> wrote:
> 
> Interesting! I never saw any collections outside of the String views implement that, probably because the swift standard library docs don’t publish underscore-prefixed protocols.

The Array types all implement it.

> 
> -DW
> 
>> On Dec 31, 2015, at 3:34 PM, Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>> wrote:
>> 
>> On Thu, Dec 31, 2015 at 9:17 PM, David Waite via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> - Array has additional mutating methods which are not described by CollectionType or any other protocol. The ease of getting a new copy of an array and mutating it means code needing the ability to append (for instance) today will be declared using an explicit Array type. If this was desired to be fixed, it would require more protocols (ModifiableCollectionType?)
>> 
>> There is a protocol, RangeReplaceableCollectionType.
>> 
>> 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 <gribozavr at gmail.com <mailto:gribozavr at gmail.com>>*/
> 

-Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151231/2679f6cf/attachment.html>


More information about the swift-evolution mailing list