<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=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2017, at 3:09 AM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><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="">2) Libraries like Marshal (<a href="https://github.com/utahiosmac/Marshal" class="">https://github.com/utahiosmac/Marshal</a>) and Unbox (<a href="https://github.com/JohnSundell/Unbox" class="">https://github.com/JohnSundell/Unbox</a>) don’t require the decoding functions to provide the type: those functions are generic on the return turn and it’s automatically inferred:</div><div class=""><br class=""></div><div class="">func decode&lt;T&gt;(key: Key) -&gt; T</div><div class=""><br class=""></div><div class="">self.stringProperty = decode(key: .stringProperty) // correct specialisation of the generic function chosen by the compiler</div><div class=""><br class=""></div><div class="">Is there a reason the proposal did not choose this solution? Its quite sweet.</div></div></div></blockquote><div><br class=""></div><div>IMHO those are only “sweet” until you need to decode a value out to something other than a typed value, then it’s ambiguity city. There are many ways to solve that, but none of them are conducive to beginners. Using the metatype to seed the generic resolution is the only thing I’d get behind, personally.</div></div><div class=""><br class=""></div><div class=""><div>Zach Waldowski</div><div><a href="mailto:zach@waldowski.me" class="">zach@waldowski.me</a></div></div><div class=""><br class=""></div></body></html>