[Accepted] SE-0173: Add MutableCollection.swapAt(_:_:)


(Ted Kremenek) #1

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0173-swap-indices.md

The review of “SE-0173: Add MutableCollection.swapAt(_:_:)” (originally named "Add MutableCollection.swap(_:with:)”) ran from April 25...28, 2017.

The proposal is accepted, including the revision to change the method name from “swap(_:with:)” to “swapAt(_:_)” that came out of the Core Team meeting.

The consensus on swift-evolution was to add the method, with division mostly on the naming of the method. The Core Team reviewed the proposed options as well as consulted the API design guidelines to resolve the issue:

https://swift.org/documentation/api-design-guidelines/

Two important points from the guidelines serve to us well here:

  "Omit all labels when arguments can’t be usefully distinguished”

and:

  "When the first argument forms part of a prepositional phrase, give it an argument label...An exception arises when the first two arguments represent parts of a single abstraction….In such cases, begin the argument label after the preposition, to keep the abstraction clear."

The combination of these rules leads to the method name “swapAt(_:_:)”, which the Core Team believes was most in line with the guidelines. The proposal is accepted with this revision.

Thanks to everyone who participated in the review!

  - Ted
  Review Manager