<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="">Loud and clear! :-)</div><div class="">I am, however, very interested in the thoughts of the Swift evolution community for this idea.</div><div class=""><br class=""></div><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">– Louis D'hauwe</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 30 Mar 2017, at 23:28, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Mar 30, 2017, at 2:03 PM, Louis D'hauwe via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Apple frameworks contain prefixes, carried over from Objective-C.<br class="">These exist to prevent class and method name collisions.<br class=""><br class="">Mattt Thompson has a great article about this, containing the following brilliant excerpt:<br class="">"Namespacing is the preeminent bugbear of Objective-C. A cosmetic quirk with global implications, the language’s lack of identifier containers remains a source of prodigious quantities of caremad for armchair language critics." (<a href="http://nshipster.com/namespacing/" class="">http://nshipster.com/namespacing/</a>)<br class=""><br class="">Since Swift can handle with these naming conflicts, wouldn't it make sense to drop all framework prefixes in a Swift environment?<br class=""><br class="">A classic example is UIKit, where all classes are prefixed with "UI".<span class="Apple-converted-space"> </span><br class="">Code example:<br class=""><br class=""> import UIKit<br class=""><br class=""> class FooViewController: UIViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""> }<br class=""><br class="">Dropping the prefix would simply lead to the following:<br class=""><br class=""> import UIKit<br class=""><br class=""> class FooViewController: ViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""> }<br class=""><br class="">Since conflicts need to be handled by specifying the module name, the following could be used if "ViewController" was also used by either some, other than UIKit, imported framework or by a user defined class:<br class=""><br class=""> import UIKit<br class=""><br class=""> class FooViewController: UIKit.ViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""> }<br class=""><br class="">"UIKit.ViewController" is of course quite longer than the current "UIViewController".<br class="">An improvement could be to allow frameworks to specify an abbreviated form.<br class="">UIKit could define "UI" as its abbreviation, making the following code valid:<br class=""><br class=""> import UI<br class=""><br class=""> class FooViewController: UI.ViewController {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><br class=""> }<br class=""><br class="">This all seems to me like a natural continuation of SE-0086.<br class="">I do realise this would be a major change, breaking pretty much every Swift iOS, macOS, tvOS and watchOS project.<br class="">But in the long term, I think it's worth it.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The teams at Apple own how their APIs get reflected in Swift. This is outside the scope of swift-evolution.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Joe</span></div></blockquote></div><br class=""></body></html>