[swift-evolution] [Review] SE-0086: Drop NS Prefix in Swift Foundation

Philippe Hausler phausler at apple.com
Tue May 10 14:59:22 CDT 2016


> On May 10, 2016, at 12:48 PM, Philippe Hausler via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> On May 10, 2016, at 11:11 AM, Ben Rimmington via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> <https://github.com/apple/swift-evolution/blob/master/proposals/
>> 0086-drop-foundation-ns.md>
>> 
>> +1 to dropping the NS prefix; type names are more readable. However:
>> 
>> * AppKit, CoreData, and TextKit will still use the NS prefix.
>> * Prefixed names (in all frameworks) are more "googleable".
>> * Should deprecated types (e.g. NSMessagePort) keep the prefix?
>> 
>> +1 to using nested enums/options; it will make method signatures shorter.
>> 
>> You could also have a nested RunLoop.Timer class (cf. CFRunLoopTimer) and
>> move your experimental `scheduledTimer` method to the RunLoop class.
>> 
>> Will top-level constants/functions also be nested? For example:
>> 
>> * SE-0033: Import Objective-C Constants as Swift Types
>> * SE-0044: Import as Member
>> 
>> Missing from the "Drop NS prefix" list:
>> 
>> * NSBinarySearchingOptions

More corrections: this will drop it’s NS

>> * NSCopying, NSMutableCopying
> 
> The reasoning behind these keeping NS is that almost all of the mutable copying items have a correlative structural type; e.g. Data, Array, Dictionary, Set etc.
> 
>> * NSDirectoryEnumerator
> 
> NSDirectoryEnumerator is going to be hoisted into FileManager.DirectoryEnumerator (I think the proposal may have missed this one)
> 
>> * NSEnumerationOptions

As will this.

>> * NSEnumerator
> 
> NSEnumerator is used to enumerate the NS collections of references
> 
>> * NSExpression
> 
> This is very tied to KVC and reference collections
> 
>> * NSNull
> 
> Not really applicable in swift since you can have an array of options etc.
> 
>> * NSSecureCoding

This was an oversight and should have it’s prefix dropped as well.

>> * NSSortOptions

NSSortOptions  also will shed it’s prefix

>> 
>> Missing from the "Hoisted types" list:
>> 
>> * NSAffineTransformStruct
> 
> This one is actually being renamed a bit differently; it will be called AffineTransform to the counterpart reference type NSAffineTransform
> 
>> * NSDateComponentsFormatterUnitsStyle
> 
> This is missing from the proposal and should be listed as DateComponentsFormatter.UnitsStyle
> 
>> * NSDateComponentsFormatterZeroFormattingBehavior
> 
> This is missing from the proposal and should be listed as DateComponentsFormatter.ZeroFormattingBehavior
> 
>> * NSRoundingMode
> 
> This is missing from the proposal and should be listed as Decimal.RoundingMode
> 
>> 
>> -- Ben
>> 
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> The others I need to follow up on with Tony to determine if they need better refinements.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160510/f422e3eb/attachment.html>


More information about the swift-evolution mailing list