[swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType
Charles Srstka
cocoadev at charlessoft.com
Tue May 24 18:32:58 CDT 2016
> On May 24, 2016, at 5:45 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
>
>> On 24 May 2016, at 21:14, Leonardo Pessoa <me at lmpessoa.com <mailto:me at lmpessoa.com>> wrote:
>>
>> My first question here would be "what's the gain?" I understand
>> CollectionTypes and arrays may be something different but I myself
>> admit I don't know and wonder how that change would be a benefit to
>> us?
>
> Instead of functions only accepting an Array, which is a specific type, they would accept any collection type, including all the lazy collections.
Among other things, one practical advantage of this is that since ArraySlice conforms to CollectionType, one could simply subscript an array if they wanted to send only a subset of its contents to a method, without having to incur the performance cost of creating a new array.
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160524/85cded4c/attachment.html>
More information about the swift-evolution
mailing list