<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2017, at 1:24 PM, Matthew Johnson 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 Mar 16, 2017, at 2:58 PM, David Hart 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 class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 16 Mar 2017, at 19:34, 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=""><div class=""><div class="" style="font-family: Arial;">On Thu, Mar 16, 2017, at 02:23 PM, Matthew Johnson via swift-evolution wrote:<br class=""></div><blockquote type="cite" class=""><div class="" style="font-family: Arial;">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 class="" style="font-family: Arial;"><br class=""></div><div class="" style="font-family: Arial;">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 class="" style="font-family: Arial;"><br class=""></div><div class="" style="font-family: Arial;">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="">Two arguments:</div><div class=""><br class=""></div><div class="">1) Most of the time, you will be setting the return value of decode into a typed property and will not need ‘as’.</div><div class="">2) Even when you do need it, its not tricky syntax: it’s the official way to direct the type inference engine in Swift.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">+1 to both of David’s points. &nbsp;Needing to explicitly resolve ambiguity during decoding is pretty rare. &nbsp;When necessary the syntax is perfectly reasonable. &nbsp;Swift users who don’t understand single statement inference works and how to guide the inference engine should learn about these topics sooner or later. &nbsp;It won’t be a hard topic to search if a user runs into trouble either. &nbsp;</div><div class=""><br class=""></div><div class="">Nevertheless, if the Foundation team is strongly opposed to this many of us will just write our own wrappers. &nbsp;This isn’t hard but it makes Swift code less consistent throughout the community. &nbsp;Supporting consistent usage throughout the community seems like a reasonable goal to me. &nbsp;IMO that means not leaving obvious expressivity gaps that are easy to fill. &nbsp;In this case, there is a very good reason why we prefer subscripts and return type inference. &nbsp;It makes our code much more clear by omitting a bunch of needless and noisy words (which is one of the principles of the API Design Guidelines).</div><br class=""></div></div></blockquote><div><br class=""></div>Hi Matthew,</div><div><br class=""></div><div>While fully acknowledging that the proposed API adds some “wordiness", I would also like to point out that the Swift API guidelines also explicitly state a goal to avoid overloading on return type:</div><div><br class=""></div><div>"Lastly, avoid “overloading on return type” because it causes ambiguities in the presence of type inference.”</div><div><br class=""></div><div>- Tony</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="text-align: start; text-indent: 0px;" class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">David.</div><br class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class=""><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 class="" style="font-family: Arial;"><br class=""></div><div class="" style="font-family: Arial;">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 class="" style="font-family: Arial;"><div class="" style="font-family: Arial;"><div class="" style="font-family: Arial;"><br class=""></div></div><div class="" style="font-family: Arial;"><div class="" style="font-family: Arial;"><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 class="" style="font-family: Arial;"><br class=""></div></div><div class=""><div class="" style="font-family: Arial;"><br class=""></div></div><div class=""><div class="" style="font-family: Arial;"><br class=""></div></div></div><div class="" style="font-family: Arial;"><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>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">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=""></body></html>