<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 Dec 11, 2015, at 9:40 PM, Kevin Ballard <<a href="mailto:kevin@sb.org" class="">kevin@sb.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<title class=""></title>
<div class=""><div class="">On Fri, Dec 11, 2015, at 02:39 PM, Douglas Gregor wrote:<br class=""></div>
<blockquote type="cite" class=""><div class=""> </div>
<div class=""><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 1:19 PM, Kevin Ballard via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div>
<div class=""> </div>
<div class=""><div class="">I've now submitted this proposal as a PR: <a href="https://github.com/apple/swift-evolution/pull/50" class="">https://github.com/apple/swift-evolution/pull/50</a><br class=""></div>
</div>
</blockquote><div class=""> </div>
<div class="">Thanks for writing this up!<br class=""></div>
<div class=""> </div>
<div class="">I was actually surprised that this didn’t already work; @objc is supposed to be able to rename effectively anything at this point. Given that, and that another core team member has already +1’d, we can skip the evolution process and call this a bug fix. Want to contribute a fix?<br class=""></div>
</div>
</blockquote><div class=""> </div>
<div class="">I'd love to! I'll start working on one over the weekend.</div>
<div class=""> </div>
<blockquote type="cite" class=""><div class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="">I listed one open question:<br class=""></div>
<div class=""> </div>
<div class="">Should the generated Obj-C declarations use the swift_name attribute to indicate the Swift type it came from? Proposal SE-0005 generalizes swift_name to apply to any arbitrary C or Obj-C entity, so it will be legal to put on enums.<br class=""></div>
<div class=""> </div>
<div class="">Labelling it makes it clear to the reader what the Swift equivalent is, but I'm unsure if there's any downsides to doing this.<br class=""></div>
</div>
</div>
</blockquote><div class=""> </div>
<div class="">Yes, it makes sense to use the swift_name attribute here. If you’re implementing your proposal, check out lib/PrintAsObjC/PrintAsObjC.cpp and how we use the SWIFT_COMPILE_NAME macro for this in the generated header.<br class=""></div>
</div>
</blockquote><div class=""> </div>
<div class="">Will do. My worry with using swift_name is that, at least in the clang that ships with Xcode 7.2, you can't actually put the swift_name attribute on an enum. I assume that will change with SE-0005, but I also assume this hasn't been implemented yet. And even when it is implemented, emitting it will be a backwards-compatibility hazard if the generated header needs to work with older clangs. Is there any way to suppress the error?</div></div></div></blockquote><div><br class=""></div><div>Hrm, that’s a good point. The generalized swift_name support is implemented in upstream Clang, but you’re right that Xcode 7.2 won’t be able to parse it. We can add a “__has_feature” entry for generalized swift_name in Clang and wrap this particular use of swift_name in</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#if __has_feature(generalized_swift_name)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// ...</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#endif</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">
<div class="">I'm also not sure offhand where you actually put the attribute on an enum, since the enum definition is actually 2 declarations, one for the typedef and one for the enum itself. Would it go after the `enum` keyword, in the place where SWIFT_ENUM_EXTRA is? </div></div></div></blockquote><br class=""></div><div>Yes, that’s correct.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></div></body></html>