<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 27, 2017, at 1:48 PM, Adrian Zubarev via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; 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-stroke-width: 0px; background-color: rgb(254, 254, 254);"><ul style="margin: 15px 0px;" class=""><li style="margin: 15px 0px; -webkit-margin-before: 0px;" class=""><p style="margin: 15px 0px; -webkit-margin-before: 0px;" class="">Assuming we’ll get that functionality, both<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">var</code><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">let</code><span class="Apple-converted-space"> </span>should satisfy the protocol requirements right?</p></li></ul></div></div></blockquote>In theory, there’s no reason not to allow that.</div><div><br class=""><blockquote type="cite" class=""><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; 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-stroke-width: 0px; background-color: rgb(254, 254, 254);"><ul style="margin: 15px 0px;" class=""><li style="margin: 15px 0px;" class=""><p style="margin: 15px 0px; -webkit-margin-before: 0px;" class="">If it is valid, could we potentially get optional functions in pure Swift as well?</p><div class=""><br class=""></div></li></ul></div></blockquote>I mean, you can already do this:</div><div><br class=""></div><div>protocol P {</div><div> var optionalRequirement: ((Int) -> ())? { get }</div><div>}</div><div><br class=""></div><div>extension P {</div><div> // “default implementation"</div><div> var optionalRequirement: ((Int) -> ())? { return nil }</div><div>}</div><div><br class=""></div><div>struct A : P {}</div><div><br class=""></div><div>struct B : P {</div><div> let optionalRequirement: ((Int) -> ())? = { (x: Int) in print(x) }</div><div>}</div><div><br class=""></div><div>But it’s kind of tacky.</div><div><br class=""></div><div>If you think about it, “optional requirement” is an oxymoron. What’s your use-case?</div><div><br class=""></div><div>Slava</div></body></html>