[swift-evolution] [DRAFT] Aliasing the OS X Platform Configuration Test

Charlie Monroe charlie at charliemonroe.net
Thu Jun 16 11:53:46 CDT 2016


> On Jun 16, 2016, at 6:02 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jun 16, 2016, at 9:55 AM, David Waite <david at alkaline-solutions.com <mailto:david at alkaline-solutions.com>> wrote:
>> 
>> (repost) 
>> 
>> Two comments:
>> 
>> - I’ll specifically call out that I think treating this as an alias rather than a new platform is appropriate - it would be confusing for users if the existing #if os(osx) did not match Sierra.
>> 
>> - Do you anticipate a separate proposal deprecating #if os(osx) ?
>> 
>> -DW
> 
> I do not anticipate deprecating the OSX test. Swift will and can be deployed to OS X as well as macOS. I've been tossing this around in my head for a few days now and my thoughts are:
> 
> * the configuration test should not remain as #if os(OSX) because that's the wrong name

Agreed.

> * replacing OSX with macOS places an undue burden on existing code

Since Swift 3.0 is a code-breaking change my guess is that there is no burden if the Xcode migration assistent automatically changes all #if os(osx) to #if os(macos), thus deprecating the term osx, not burdening the developer at all.

> * aliasing the two may cause issues down the road ("why does this test have two names") but I think developers are smart enough to figure out why both variations exist

I don't see them as two different OSs, mostly since version-wise it's OS X 10.11 and macOS 10.12. It's the same OS, different name - it IMHO should be an alias. 

If iOS was renamed to phoneOS and kept versioning, you'd still expect #if os(ios) to be matched when targetting phoneOS and vice-versa.

If you need to differentiate between versions of the OS, there are #if available(*) "macros" or simply NSAppKitVersion constants.

> * developers can and will still deploy to OS X for Yoze and El Cap

Sure, but with Xcode 8 and Swift 3, the SDK will still be for macOS 10.12, so it could simply say #if os(macos), even when targetting prior OSs.

All, of course, unless you want to apply these changes to Swift 2.x as well.

> 
> -- Erica
> 
>> 
>>> On Jun 16, 2016, at 8:29 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> Starting in Sierra, Apple's Mac-based OS is renamed to macOS.
>>> 
>>> All user-facing Swift APIs must go through Swift Evolution. While this is a trivial API change, I have put together a formal proposal as is normal and usual for this process. Here is a draft for public comment.
>>> 
>>>  -- Erica
>>> 
>>> Gist:  https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2 <https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2>
>>> 
>>> Aliasing the OS X Platform Configuration Test
>>> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160616/9b1a7d4b/attachment.html>


More information about the swift-evolution mailing list