[swift-dev] SR-122 / CollectionsMoveIndices.swift Prototype

Dmitri Gribenko gribozavr at gmail.com
Mon Mar 14 14:50:57 CDT 2016

On Mon, Mar 14, 2016 at 11:57 AM, Shawn Erickson <shawnce at gmail.com> wrote:
> On Thu, Mar 10, 2016 at 10:49 PM Dmitri Gribenko <gribozavr at gmail.com>
> wrote:
>> Hi everyone,
>> I just wanted to announce that we have sufficient change on the
>> swift-3-indexing-model branch so that we can build the core standard
>> library and StdlibUnittest.  We achieved this by putting the protocol
>> new structure into place, and stubbing out with fatalError() or just
>> commenting out parts that didn't compile.  Now we have a baseline that
>> we won't regress, and we are starting to work towards improving it,
>> making existing tests pass, and then writing new tests, and addressing
>> TODOs and FIXMEs that we left in the code as we were doing the first
>> pass.
>> Here's the most recent pull request from Shawn where he starts to fix
>> the tests: https://github.com/apple/swift/pull/1632
>> Now we are in the "massively-parallel" stage of this project and we,
>> as always, welcome contributions to this branch!
> Is their a reason we are suppressing sort in place for MutableCollections?

No, that wasn't intentional.

> benchmark/single-source/StaticArray.swift:86:17: error: 'sort()' has been
> renamed to 'sorted'
>     staticArray.sort()
>                 ^~~~
>                 sorted
> Swift.MutableCollection:3:17: note: 'sort()' has been explicitly marked
> unavailable here
>     public func sort() -> [Self.Iterator.Element]
>                 ^
> In CollectionAlgorithms we have `sortInPlace` marked as unavailable renamed
> to `sort` and `sort -> [Iterator.Element]` marked as unavailable renamed
> `sorted`.
> I believe we want `sort()` to be the mutating one (in place) and `sorted()`
> to return a sorted version, right? I poke around more on this. It could be
> we have an overzealous unavailable?

I think that's right.  There is a mutating implementation already in
CollectionAlgorithms.swift.gyb, which is followed by an unavailable
one with a renamed clause.  I think we should remove the unavailable


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-dev mailing list