<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It’s definitely more effort needed than i thought at first. I can create an API suggestion, but that will take a while. Since this will happen in Swift 5 or later, we will have enough time anyway.<div class=""><br class=""></div><div class="">Does it make sense to create a proposal on GitHub or should I wait at least for Swift 5 since this is out of scope for Swift 4?</div><div class=""><br class=""></div><div class="">- Maik<br class=""><div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 12.06.2017 um 18:35 schrieb Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2017, at 8:42 AM, Tony Parker &lt;<a href="mailto:anthony.parker@apple.com" class="">anthony.parker@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">This is still something I want to do, but I suspect it will require some coordination work with the NSOrderedSet ref type in Foundation.<div class=""><br class=""><div class="">Also, as Doug says, there is a larger question too of how we make source breaking changes like this in Swift 5 (I think we’re probably out of runway for Swift 4 at this point).</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Definitely too late for Swift 4.&nbsp;</div><div class=""><br class=""></div><div class="">Whether we should do it in Swift 5 depends on the source-compatibility story. The Swift 4 compiler has the ability to present imported types to Swift 3.2 differently from Swift 4, which we used to stage in (e.g.) subclass existentials and SDK changes. We could conceivably do the same for NSOrderedSet &lt;-&gt; OrderedSet bridging, suppressing bridging of NSOrderedSet in imported APIs for Swift &lt;= 4.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class="">We would want to bridge this in from the SDK, but if it follows the pattern of our value types, we need to make API changes from the ref type to make it fit in correctly with Swift-only concepts like the Collection protocols.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Sure, we’d need to design it to fit well with the standard library and provide the APIs people expect from NSOrderedSet.</div><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class="">- Tony</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jun 9, 2017, at 4:28 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Jun 9, 2017, at 10:19 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">Let me try to redirect this conversation, if I may.<br class=""><br class="">As far as I can tell, SE-0069 states plainly that the plan of record is to offer a value type called OrderedSet in Foundation, but resources to design and implement were not then available.<br class=""><br class="">So, little point in having a vote as to whether one is in favor of OrderedSet or not. In my view, the questions to be answered are:<br class=""><br class="">For the core team–<br class=""><br class="">* Is it still the plan to offer value types postponed from SE-0069 as a future addition to Foundation?<br class=""></div></blockquote><div class=""><br class=""></div>*I* think it’s still a good idea, and I suspect that others on the core team will agree.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><div class="">* If so, is that a priority in the Swift 5 timeframe, and how can the community help to bring about this addition?<br class=""></div></blockquote><div class=""><br class=""></div>I wouldn’t consider it a “priority”, in the sense that I can’t imagine anything in Swift 5 that would absolutely require us to introduce this functionality in that time frame. It’s a bit of a nice-to-have-at-any-point, noting of course that bridging NSOrderedSet in existing APIs is a nontrivial source-breaking change.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Having a proposed API and implementation on hand makes it easier to add this functionality, of course.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class="">If not, for the whole community–<br class=""><br class="">* Is it wise to implement such a type in the standard library? Should we simply bring over the native implementation from Swift Package Manager? What are the implications for bridging?<br class=""></div></blockquote><div class=""><br class=""></div><div class="">Obviously, we’d want an efficient copy-on-write, native implementation; the Swift Package Manager implementation is a bit more bare-bones than we’d want: absolute performance matters, so having a separate Set + Array in the struct probably isn’t good enough. Bridging performance matters, so we’d probably want the one-pointer representation like array uses where the pointer can be vended directly to Objective-C.</div><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Jun 9, 2017 at 11:38 Remy Demarest via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="auto" class="">+1 for ordered set and dictionary, and please add ordered dictionary in ObjC as well.<br class=""><br class=""><div id="m_8126729879696255769AppleMailSignature" class="">Envoyé de mon iPhone</div></div><div dir="auto" class=""><div class=""><br class="">Le 9 juin 2017 à 03:11, Robert Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; a écrit&nbsp;:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class=""></div><div class="">+1, and would also like to see OrderedDictionary as well.</div><div class=""><br class="">On Jun 9, 2017, at 12:50 AM, Jeff Kelley via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">I would be in favor of it; there have been a few times (including Core Data, as you mentioned) where I would have used it had it been available.<div class=""><br class=""></div><div class=""><br class=""><div class=""><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;"><div class="" style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;"><div class="" style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;"><div class="" style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;"><div class="" style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;"><span class="m_8126729879696255769Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; border-spacing: 0px;"><div class="" style="word-wrap: break-word;"><div class="">Jeff Kelley</div><div class=""><br class=""></div><div class=""><a href="mailto:SlaunchaMan@gmail.com" target="_blank" class="">SlaunchaMan@gmail.com</a>&nbsp;|&nbsp;<a href="https://twitter.com/SlaunchaMan" target="_blank" class="">@SlaunchaMan</a>&nbsp;|&nbsp;<a href="http://jeffkelley.org/" target="_blank" class="">jeffkelley.org</a></div></div></span></div></div></div></div></div></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 7, 2017, at 2:10 PM, Maik Koslowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_8126729879696255769Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class="">Hello,<br class=""><div class=""><div class=""><div class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div class=""><br class=""></div><div class="">in the past there have been a few requests for an OrderedSet implementation in Swift. In the proposal&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0069-swift-mutability-for-foundation.md" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0069-swift-mutability-for-foundation.md</a>&nbsp;was mentioned that the OrderedSet will be considered for the feature.</div><div class=""><br class=""></div><div class="">However, since then there were a few discussions on OrderedSet but it doesn’t get much attention and there wasn’t any comment about it from the swift team.</div><div class=""><br class=""></div><div class="">I want to bring up some points, why an OrderedSet is needed in the base library.</div><div class=""><br class=""></div><div class="">1. CoreData is probably the most obvious place where people would use an ordered set. Especially when working with large amounts of data, presorting can save a lot of time and battery life. If a bridgeable ordered set was part of the standard library we could use a ordered set in swift without having to use the NSOrderedSet from objective c. Which would be pretty nice in my opinion. Even when using a NSOrderedSet we couldn’t have a generic version of it.</div><div class=""><br class=""></div><div class="">2. A shared datamodel between App and Server. One main advantage of having web servers written in Swift is that we can share code between the server and the app. For servers performance does matter a lot, since they are usually working with much more data than apps. Databases are represented as sets and fetching sorted data from the database can be represented as an ordered set. However, since we don’t have ordered sets we have to choose either a normal set or an array. Sets don’t have an order and arrays can contain the same object multiple times, which makes them both a less suitable choice.</div><div class=""><br class=""></div><div class="">3. Swift has the potential to be used for education. There is a lot of support, for example the playground app on iPad. When it comes to the theory behind data structures and algorithms or to the theory of computation a defined order plays an important role.</div><div class=""><br class=""></div><div class="">The biggest issue is that we always have to copy data from a set into an array to have it in a sorted order with losing the safety of uniqueness. Which is not suitable for a safe and performance oriented programming language at all.</div><div class=""><br class=""></div><div class="">Last but not least, it fits in the goals of Swift 4 stage 2 and an ordered set can be found in other popular programming languages, too.</div><div class=""><br class=""></div><div class="">What do you think?</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Maik</div></div></div></div></div></div></div><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></body></html>