We’ve seen some increased discussion recently about the idea of a
struct OrderedSet to complement the Foundation
class NSOrderedSet type. This is something we’ve been thinking about for a while. I think this is a great opportunity to bring the community together to collaborate on a new API for Foundation.
I’d like to start a discussion here, and am looking for help from the community to develop a full API proposal for this type. I’ve discussed this idea with members of the Swift standard library team and we agree that we should start with this type as API in the Foundation project. We will target Swift 5 as the release for this new functionality.
We will run this review using the swift-evolution process, slightly tailored for Foundation. I think this will feel a lot like the Swift package manager proposals. I will act as the review manager.
struct OrderedSet will be written as part of the Swift overlay for Foundation, we can have the implementation done completely in open source as part of Swift. There is no requirement for changes in the Objective-C implementation, or a requirement for a new corresponding Objective-C implementation.
Here are what I believe to be the basic requirements:
structtype and value semantics
- Adoption of appropriate Swift standard library collection protocols
- API that feels like it fits in with other Swift collection types
- No bridging to the
class NSOrderedSettype. Bridging introduces the possibility for a source incompatibility, and we have decided that we wish to stop introducing source incompatibilities.
- Shared implementation with
I’m excited to have the ability to collaborate with all of you on a major new API for Foundation.