<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>As the problem seems to be to eliminate having to write the extension with all its duplication, <span style="background-color: rgba(255, 255, 255, 0);">I'd prefer a more general solution i</span>nstead of introducing the notion of an "optional" function: just make it possible to write default implementations inline in a protocol definition. </div><div><br></div><div>Documenting the optionality can be done in the doc comment, maybe with a new documentation keyword "default". Having "optional" in the code has no additional value over a comment because the method is not optional in the Obj-C sense and the proposal requires a default value. Therefore the presence of "optional" has essentially no effect at all and is better moved into a comment.</div><div><br></div><div>-Thorsten </div><div><br>Am 04.04.2016 um 00:13 schrieb Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 3, 2016, at 10:40 AM, Andrey Tarantsov <<a href="mailto:andrey@tarantsov.com" class="">andrey@tarantsov.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div 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-stroke-width: 0px;" class=""><div class="">Protocol requirements with default (no-op) implementations already satisfy that design goal, no?</div></div></div></blockquote><br class=""></div><div class="">Chris, as we've discussed in a thread that I think got forked from this one:</div><div class=""><br class=""></div><div class="">Yes, they do technically, but it would be nice to both:</div><div class=""><br class=""></div><div class="">1) make it an obvious documented part of the signature, possibly including the default return value</div><div class=""><br class=""></div><div class="">2) possibly make it less verbose by getting rid of the explicitly spelled out protocol extension</div></div></div></blockquote><br class=""></div><div>Right, but “more is worse” when it comes to language design. Having a "more general" facility that greatly overlaps with a “more narrow” facility always makes us question whether it is worth the complexity to have both.</div><div><br class=""></div><div>-Chris</div><br class=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>