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

Philippe Hausler phausler at apple.com
Tue May 10 14:48:43 CDT 2016


> 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
> * 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
> * 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
> * NSSortOptions
> 
> 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
> 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.


More information about the swift-evolution mailing list