<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPhone</div><div><br>On Apr 24, 2016, at 3:24 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Apr 24, 2016 at 4:28 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Apr 22, 2016, at 8:02 PM, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
><br>
><br>
> Sent from my iPhone<br>
><br>
>> On Apr 22, 2016, at 5:56 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>> wrote:<br>
>><br>
>> Not an expert on Obj-C compatibility in Swift by any means, but this<br>
>> reads like it's largely a change of nomenclature. To me, though,<br>
>> `objcoptional` reads exceedingly poorly. Why not emphasize the Obj-C<br>
>> compatibility angle by requiring the `@objc` attribute to precede each<br>
>> use of `optional`? (In other words, effectively rename `optional` to<br>
>> `@objc optional`.)<br>
><br>
> That is a great idea.<br>
<br>
</span>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></blockquote><div><br></div><div>Perhaps they will, but IMO it's an improvement. In the current implementation, `optional func` is spatially divorced from the `@objc` annotation on the containing protocol. There's nothing in the code that helps you to deduce that the two are tied to each other in some way. With an immediate juxtaposition, it's much more explicable that optional functions must be @objc functions. </div></div></div></div></div></blockquote><div><br></div><div>Yeah. I also think the diagnostic will be part of the messaging. If you leave off the @objc, the compiler can have an error along the lines of "optional requirements are an Objective-C compatibility feature; add '@objc'</div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>To my mind, it reads similarly to how throwing functions must be called with some sort of `try`.</div><div><br></div><div>(FWIW, my hunch is that if the keyword were named `objcoptional` to begin with, you'd still have people proposing to extend optional requirements to pure-Swift protocols and renaming the keyword `optional`.)</div><div><br></div></div></div></div>
</div></blockquote></body></html>