<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 Apr 24, 2016, at 3:28 PM, Chris Lattner 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=""><br class=""><blockquote type="cite" class="">On Apr 22, 2016, at 8:02 PM, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""><br class=""><br class="">Sent from my iPhone<br class=""><br class=""><blockquote type="cite" class="">On Apr 22, 2016, at 5:56 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:<br class=""><br class="">Not an expert on Obj-C compatibility in Swift by any means, but this<br class="">reads like it's largely a change of nomenclature. To me, though,<br class="">`objcoptional` reads exceedingly poorly. Why not emphasize the Obj-C<br class="">compatibility angle by requiring the `@objc` attribute to precede each<br class="">use of `optional`? (In other words, effectively rename `optional` to<br class="">`@objc optional`.)<br class=""></blockquote><br class="">That is a great idea. <br class=""></blockquote><br class="">Doesn’t this have the same problem as the current (Swift 1/2) implementation? People will continue to believe that it is a bug that you must specify @objc.<br class=""><br class="">-Chris<br class=""></div></div></blockquote><br class=""></div><div>I thought I'd throw a few ideas into the mix. I'm arriving late to the discussion. (I didn't expect the conversation to last this long.) I did take a quick look back through the thread but I may have missed some bits along the way. Apologies in advance for any redundancy:</div><div><br class=""></div><div>* Optional requirement is an oxymoron. (This is a redux of my previous contribution to this topic but it's a good starting point.)</div><div><br class=""></div><div>* Swift's "optional" protocol implementations are no such thing. They are default implementations that can be overridden. (Tangentially, why not introduce a required "override" keyword for conforming types that implement a version of a member introduced in protocol extensions? This would match the class approach and enhance safety and intent.)</div><div><br class=""></div><div>* Swift already has an `Optional` type. Importing ObjC "optional" protocol requirements is therefore semantically problematic from a Swift development POV. I don't like either the "@objcoptional" or "@objc optional" solutions mentioned upthread. They overload "optional" syntactically and confuse semantics. I think the key words that better describe what's happening in, for example, a `UITableViewDelegate`, are "<i class="">discretionary</i>" or "<i class="">elective</i>" implementations. Swift has renamed lots of Objective C things (waves hi to <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md" class="">SE-0005</a>). Why not "optional"?</div><div><br class=""></div><div>* I do *support* retaining `@objc` in some form and I believe it can be addressed in a way that does not appear to be a bug. "Optional protocol conformance" is a behavior that is external to the language. I do not believe would be voluntarily added to Swift should the topic arise. Therefore I find it insufficient to introduce attributes like `@elective` or `@discretionary` in order to satisfy non-native requirements. I would prefer to see the @objc attribute be extended to support these and any future Objective-C-specific behaviors: @objc(elective), @objc(importedProtocolSupport: elective), or whatever. While these are wordy, I assume like any other Swift attributes they can be placed on a line before the function declaration, and it would be instantly clear why they've been placed there, and they would not overlap with Swift semantics *or* expectations. I leave the color of the bikeshed as an exercise for the reader.</div><div><br class=""></div><div>-- Erica</div><div><br class=""></div></body></html>