<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Matt,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 17, 2017, at 6:39 AM, Matt Diephouse 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=""><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=""><div class="">I have two related questions:</div><div class=""><br class=""></div><div class="">&nbsp; 1. Why was Swift 4 chosen as the target release for adding archival and serialization?</div><div class=""><br class=""></div><div class="">&nbsp; 2. Given Swift compatibility requirements going forward, how much will the design of these APIs be able to change?</div></div></div></blockquote><div><br class=""></div>I responded to this partially elsewhere in this thread, but the summary is: Swift developers are working with archiving and serialization right now and they deserve a better API that they can use as soon as possible. The language will always continue to evolve and improve.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">The overall impression I get from the APIs is that they’ve been shaped by the current limitations of Swift (a familiar constraint). There are a number of likely future improvements that would likely significantly benefit this proposal:</div><div class=""><br class=""></div><div class="">&nbsp; 1. Throwing subscripts, as mentioned here</div><div class=""><br class=""></div><div class="">&nbsp; 2. Improved generics, such that protocols could be used instead of abstract base classes</div><div class=""><br class=""></div><div class="">&nbsp; 3. Improved type inference, as mentioned previously in the thread about inferring return types</div><div class=""><br class=""></div><div class="">&nbsp; 4. Dynamism/reflection in whatever form Swift adds would be very closely related, but more general, potentially influencing this design</div><div class=""><br class=""></div><div class="">Some of these could lead to improved, non-additive APIs. Will the archival and serialization APIs be able to be updated in response to improvements like these?</div></div></div></blockquote><div><br class=""></div><div>Yes, that is the plan. Our job during every release is to take a look at our APIs and implementations and make them better. Often times that means adjusting to new language features and other library features as they are released.</div><div><br class=""></div><div>Another thing to remember is that library features can help drive language features. By releasing API like this, we are providing great motivation to pick what language features are most important going forward.</div><div><br class=""></div><div>- Tony</div><br class=""><blockquote type="cite" class=""><div 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 Mar 16, 2017, at 5:12 PM, Itai Ferber 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="">


<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" class="">

<div class="">
<div style="font-family:sans-serif" class=""><div style="white-space:normal" class=""><p dir="auto" class="">If throwing subscripts made it in the Swift 4 timeframe, then we would certainly consider it.</p><p dir="auto" class="">On 16 Mar 2017, at 13:19, Matthew Johnson wrote:</p>
</div>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class=""><div id="1425E752-F96A-431C-AECA-8B4FCA0ADE22" 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 Mar 16, 2017, at 3:01 PM, Itai Ferber &lt;<a href="mailto:iferber@apple.com" class="">iferber@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">


<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" class="">

<div class="">
<div style="font-family:sans-serif" class=""><div style="white-space:normal" class=""><p dir="auto" class="">Subscripts, by the way, would not help here, since they cannot throw. <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">decode</code> must be able to throw.<br class="">
<a href="https://bugs.swift.org/browse/SR-238?jql=text%20%7E%20%22subscript%20throw%22" style="color:#3983C4" class="">SR-238</a>; for Apple folks, 28775436.</p></div></div></div></div></blockquote><div class="">They don’t “help” but they do provide a more natural interface. &nbsp;If the Foundation team feels a more wordy interface is necessary that is ok.</div><div class=""><br class=""></div><div class="">I specifically mentioned that they can’t throw yet. &nbsp;Throwing subscripts would make a good companion proposal if they could fit into the Swift 4 timeframe. &nbsp;If not, then yes we need a method rather than a subscript. &nbsp;But if we can get throwing subscripts into Swift 4, why not use Swift’s first class syntactic support for keyed access to keyed containers?</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class=""><div style="font-family:sans-serif" class=""><div style="white-space:normal" class=""><p dir="auto" class="">On 16 Mar 2017, at 11:46, Matthew Johnson via swift-evolution wrote:</p><div class=""><br class="webkit-block-placeholder"></div></div>
<div style="white-space:normal" class=""></div>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class=""><div id="5E490381-6C14-4BC1-91C2-6E06CCF0642F" 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 Mar 16, 2017, at 1:34 PM, Zach Waldowski 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="">


<title class=""></title>

<div class=""><div style="font-family:Arial;" class="">On Thu, Mar 16, 2017, at 02:23 PM, Matthew Johnson via swift-evolution wrote:<br class=""></div>
<blockquote type="cite" class=""><div style="font-family:Arial;" class="">I don’t have an example but I don’t see a problem either. &nbsp;There are two options for specifying the return type manually. &nbsp;We can use the signature you used above and use `as` to specify the expected type:<br class=""></div>
<div class=""><div class=""><br class=""></div>
<div class="">let i = decode(.myKey) as Int<br class=""></div>
</div>
</blockquote><div style="font-family:Arial;" class=""><br class=""></div>
<div style="font-family:Arial;" class="">The awkwardness of this syntax is exactly what I'm referring to. Would a beginner know to use "as Int" or ": Int"? Why would they? The "prettiness" of the simple case doesn't make up for how difficult it is to understand and fix its failure cases.<br class=""></div>
<div style="font-family:Arial;" class=""><br class=""></div>
<div style="font-family:Arial;" class="">Any official Swift or Foundation API shouldn't, or shouldn't need to, make use of "tricky" syntax.<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">I don’t think this is especially tricky. &nbsp;Nevertheless, we can avoid requiring this syntax by moving the type argument to the end and providing a default. &nbsp;But I think return type inference is worth supporting. &nbsp;It has become widely adopted by the community already in this use case.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">
<div style="font-family:Arial;" class=""><br class=""></div>
<blockquote type="cite" class=""><div class=""><div class="">If we don’t support this in Foundation we will continue to see 3rd party libraries that do this.<br class=""></div>
</div>
</blockquote><div style="font-family:Arial;" class=""><br class=""></div>
<div style="font-family:Arial;" class="">The proposal's been out for less than 24 hours, is it really productive to already be taking our ball and go home over such a minor thing?<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">I don’t think that’s what I’m doing at all. &nbsp;This is a fantastic proposal. &nbsp;I’m still working through it and writing up my more detailed thoughts.</div><div class=""><br class=""></div><div class="">That said, as with many (most?) first drafts, there is room for improvement. &nbsp;I think it’s worth pointing out the syntax that many of us would like to use for decoding and at least considering including it in the proposal. &nbsp;If the answer is that it’s trivial for those who want to use subscripts to write the wrappers for return type inference and / or subscripts themselves that’s ok. &nbsp;But it’s a fair topic for discussion and should at least be addressed as an alternative that was rejected for a specific reason.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">
<div style="font-family:Arial;" class=""><div style="font-family:Arial;" class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div style="font-family:Arial;" class=""><div style="font-family:Arial;" class=""><span class="font" style="font-family:arial, sans-serif, sans-serif">Zach Waldowski</span><br class=""></div>
</div>
<div id="sig40804545" class=""><div class="signature"><a href="mailto:zach@waldowski.me" class=""><span class="font" style="font-family:arial, sans-serif, sans-serif">zach@waldowski.me</span></a><br class=""></div>
</div>
<div class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
<div class=""><div style="font-family:Arial;" class=""><br class=""></div>
</div>
</div>
<div style="font-family:Arial;" class=""><br class=""></div>
</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=""></div></div></blockquote>
<div style="white-space:normal" class="">
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class="">
</blockquote><p dir="auto" class="">_______________________________________________<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" style="color:#3983C4" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></p>
</div>
<div style="white-space:normal" class="">
</div>
</div>
</div>

</div></blockquote></div><br class=""></div></div></blockquote>
<div style="white-space:normal" class=""><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class="">
</blockquote></div>
</div>
</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=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>