<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 class="">Why would you want lack of an optional method to be a fatal error, either?</div><div class=""><br class=""></div><div class="">Charles</div><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 27, 2016, at 5:29 PM, Andrew Bennett <<a href="mailto:cacoyi@gmail.com" class="">cacoyi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi Charles,<div class=""><br class=""><div class="">My initial idea just had a fatalError, without a throw. It's better IMO, but less Swift-y. It's not obvious from the Swift protocol definition that this could happen. I'm not sure if it's possible for the extension method to have @noreturn or similar on it.<br class=""><br class="">On Thursday, 28 April 2016, Charles Srstka <<a href="mailto:cocoadev@charlessoft.com" class="">cocoadev@charlessoft.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><blockquote type="cite" class="">On Apr 27, 2016, at 9:30 AM, Andrew Bennett via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""></blockquote><div class=""><blockquote type="cite" class=""><br class=""><div class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Sorry if this has been discussed, but have you considered dropping optional entirely, making it throw, and a default implementation that throws a selector not found exception?</span><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><br class=""></div><div class="">This is approximately what you would expect using it in objc. I don't think it has the complexity discussed in the proposals alternatives for other call site issues.<br class=""><br class="">If it throws you can call with "try?" to get similar functionality in most cases.</div><div class=""><br class=""></div><div class="">This assumes that respondsToSelector doesn't pick up the Swift default implementation.</div></div></div></blockquote></div><br class=""><div class="">Is there any case where you’d actually want to display a runtime error as a result of a delegate not implementing an optional method, though? Even setting aside that the method’s supposed to be optional, leaving out a needed delegate method seems more like a programmer error than a runtime error.</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div></div></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>