<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Regards<div>LM</div><div>(From mobile)</div></div><div><br>On Jun 28, 2016, at 8:04 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<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 Jun 27, 2016, at 1:26 PM, Jordan Rose via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey, all. An engineer at Apple noticed the following behavior:<div class=""><br class=""></div>1. class Foo: NSObject → exposed to Objective-C, Swift-style (mangled) runtime name<br class="">2. @objc class Foo: NSObject → exposed to Objective-C, Swift-style (mangled) runtime name<div class="">3. @objc(Foo) class Foo: NSObject → exposed to Objective-C, unmangled runtime name</div><div class=""><br class=""></div><div class="">(and 4. @objc class Foo → illegal, classes must have ObjC heritage to be @objc.)</div><div class=""><br class=""></div><div class="">They specifically observed that (1) and (2) have the same behavior, and suggested that maybe (2) should be shorthand for (3).</div><div class=""><br class=""></div><div class="">Pros:</div><div class="">- There aren't two ways to spell (1).</div><div class="">- Removing the mangling (and module uniquing) from the runtime name is probably one of the most common uses of @objc on a class.</div><div class=""><br class=""></div><div class="">Cons:</div><div class="">- It's a source-breaking change, for all that the "@objc" in (2) is redundant.</div><div class="">- For protocols, (1) and (2) are <i class="">not</i>&nbsp;equivalent, because @objc isn't inherited there.</div><div class="">- Mangling is used to namespace class names at run time; if you drop that, the ObjC name should probably have a prefix. (This applies more to frameworks than apps, though.)</div></div></div></blockquote><br class=""></div><div>I’m -1 on this, because bare “@objc” in other contexts means “make sure this is exposed to Objective-C, but I don’t want to be explicit about the name” while “@objc(something)” means “make sure this is exposed to Objective-C, and ‘something’ is the name”.&nbsp;</div><div><br class=""></div></div></blockquote><div><br></div><div>-1&nbsp;</div><div>Please'o'please ... I find it useful for complexifying simple swift names into the kind that typically exists on the objc side.</div><div><br></div><br><blockquote type="cite"><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></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>