[DRAFT] Aliasing the OS X Platform Configuration Test

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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<macOS.md · GitHub

This proposal adds a #if os(macos) platform configuration test to Swift that acts like the current if os(osx)

Swift Evolution Discussion: TBD <applewebdata://3E69BB01-4D94-4BA0-B211-ED51A7CBE547>
<macOS.md · GitHub

Apple renamed its Mac operating system from OSX to macOS, starting in macOS Sierra. Adding rather than replacing "OSX" enables this adoption to be purely additive and supports the notion that Swift-based applications could be deployed to operating systems earlier than Sierrra.

<macOS.md · GitHub Art

Swift currently supports the following platform configuration tests, defined in lib/Basic/LangOptions.cpp.

The literals true and false
The os() function that tests for OSX, iOS, watchOS, tvOS, Linux, Windows, Android, and FreeBSD
The arch() function that tests for x86_64, arm, arm64, i386, powerpc64, s390x, and powerpc64le
The swift() function that tests for specific Swift language releases, e.g. swift(>=2.2)
<macOS.md · GitHub Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<macOS.md · GitHub on Existing Code

This is purely additive

<macOS.md · GitHub Considered

I think it's unwise to replace OSX instead of adding macOS due to Apple's large and active userbase that may install Swift-sourced software and not upgrade to the latest operating system.

(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

···

On Jun 16, 2016, at 8:29 AM, Erica Sadun via swift-evolution <swift-evolution@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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<macOS.md · GitHub

This proposal adds a if os(macos) platform configuration test to Swift that acts like the current if os(osx)

Swift Evolution Discussion: TBD <applewebdata://49D0E750-6244-4897-B8A6-818C4479A2DD>
<macOS.md · GitHub

Apple renamed its Mac operating system from OSX to macOS, starting in macOS Sierra. Adding rather than replacing "OSX" enables this adoption to be purely additive and supports the notion that Swift-based applications could be deployed to operating systems earlier than Sierrra.

<macOS.md · GitHub Art

Swift currently supports the following platform configuration tests, defined in lib/Basic/LangOptions.cpp.

The literals true and false
The os() function that tests for OSX, iOS, watchOS, tvOS, Linux, Windows, Android, and FreeBSD
The arch() function that tests for x86_64, arm, arm64, i386, powerpc64, s390x, and powerpc64le
The swift() function that tests for specific Swift language releases, e.g. swift(>=2.2)
<macOS.md · GitHub Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<macOS.md · GitHub on Existing Code

This is purely additive

<macOS.md · GitHub Considered

I think it's unwise to replace OSX instead of adding macOS due to Apple's large and active userbase that may install Swift-sourced software and not upgrade to the latest operating system.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Have you considered just if os(mac)? I mean the fact that you're testing against "OS" is already expressed. I know it goes against the other values (watchOS, tvOS), but I'd personally drop those as well in favor of simplier os(watch), os(tv).

This would go along the various Swift 3 improvements where e.g. NSFileManager.defaultManager() became simply FileManager.default (thus dropping the unnecessary "Manager")...

But I understand if you're against it, considering that these are really trademarks and official OS names...

···

On Jun 16, 2016, at 4:29 PM, Erica Sadun via swift-evolution <swift-evolution@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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<macOS.md · GitHub

This proposal adds a if os(macos) platform configuration test to Swift that acts like the current if os(osx)

Swift Evolution Discussion: TBD <applewebdata://591A7BC6-6FAB-4AA8-83B9-6A6B7D0E1FCA>
<macOS.md · GitHub

Apple renamed its Mac operating system from OSX to macOS, starting in macOS Sierra. Adding rather than replacing "OSX" enables this adoption to be purely additive and supports the notion that Swift-based applications could be deployed to operating systems earlier than Sierrra.

<macOS.md · GitHub Art

Swift currently supports the following platform configuration tests, defined in lib/Basic/LangOptions.cpp.

The literals true and false
The os() function that tests for OSX, iOS, watchOS, tvOS, Linux, Windows, Android, and FreeBSD
The arch() function that tests for x86_64, arm, arm64, i386, powerpc64, s390x, and powerpc64le
The swift() function that tests for specific Swift language releases, e.g. swift(>=2.2)
<macOS.md · GitHub Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<macOS.md · GitHub on Existing Code

This is purely additive

<macOS.md · GitHub Considered

I think it's unwise to replace OSX instead of adding macOS due to Apple's large and active userbase that may install Swift-sourced software and not upgrade to the latest operating system.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Have you considered just if os(mac)? I mean the fact that you're testing against "OS" is already expressed. I know it goes against the other values (watchOS, tvOS), but I'd personally drop those as well in favor of simplier os(watch), os(tv).

This would go along the various Swift 3 improvements where e.g. NSFileManager.defaultManager() became simply FileManager.default (thus dropping the unnecessary "Manager")...

But I understand if you're against it, considering that these are really trademarks and official OS names...

I felt consistency with iOS/tvOS/watchOS was more important.

-- E

···

On Jun 16, 2016, at 9:29 AM, Charlie Monroe <charlie@charliemonroe.net> wrote:

On Jun 16, 2016, at 4:29 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test

Have you considered just if os(mac)? I mean the fact that you're testing against "OS" is already expressed. I know it goes against the other values (watchOS, tvOS), but I'd personally drop those as well in favor of simplier os(watch), os(tv).

This would go along the various Swift 3 improvements where e.g. NSFileManager.defaultManager() became simply FileManager.default (thus dropping the unnecessary "Manager")...

But I understand if you're against it, considering that these are really trademarks and official OS names…

I would be nervous about this personally, as there is a potential for people to confuse if os(tv) as some form of class of operating system variants targeting televisions, rather than tvOS specifically.

Plus, it would be hard to be consistent - if os(iOS) probably shouldn’t become if os(i) :-)

-DW

···

On Jun 16, 2016, at 9:29 AM, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:

On Jun 16, 2016, at 4:29 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@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: macOS.md · GitHub

(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
* replacing OSX with macOS places an undue burden on existing code
* 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
* developers can and will still deploy to OS X for Yoze and El Cap

-- Erica

···

On Jun 16, 2016, at 9:55 AM, David Waite <david@alkaline-solutions.com> wrote:

On Jun 16, 2016, at 8:29 AM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test

Have you considered just if os(mac)? I mean the fact that you're testing against "OS" is already expressed. I know it goes against the other values (watchOS, tvOS), but I'd personally drop those as well in favor of simplier os(watch), os(tv).

OS is part of the name of the OS, so it should be kept. In a crazy parallel universe, you would not want to use:
if os(/2)
to refer to OS/2, just because OS feels redundant. Or in more realistic one, you would not want to avoid redundancy with a condition like:
if phone(i)

Dany

···

Le 16 juin 2016 à 11:29, Charlie Monroe via swift-evolution <swift-evolution@swift.org> a écrit :

This would go along the various Swift 3 improvements where e.g. NSFileManager.defaultManager() became simply FileManager.default (thus dropping the unnecessary "Manager")...

But I understand if you're against it, considering that these are really trademarks and official OS names...

On Jun 16, 2016, at 4:29 PM, Erica Sadun via swift-evolution <swift-evolution@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: macOS.md · GitHub

Aliasing the OS X Platform Configuration Test
Proposal: TBD
Author: Erica Sadun
Status: TBD
Review manager: TBD
Introduction

This proposal adds a if os(macos) platform configuration test to Swift that acts like the current if os(osx)

Swift Evolution Discussion: TBD

Motivation

Apple renamed its Mac operating system from OSX to macOS, starting in macOS Sierra. Adding rather than replacing "OSX" enables this adoption to be purely additive and supports the notion that Swift-based applications could be deployed to operating systems earlier than Sierrra.

Current Art

Swift currently supports the following platform configuration tests, defined in lib/Basic/LangOptions.cpp.

The literals true and false
The os() function that tests for OSX, iOS, watchOS, tvOS, Linux, Windows, Android, and FreeBSD
The arch() function that tests for x86_64, arm, arm64, i386, powerpc64, s390x, and powerpc64le
The swift() function that tests for specific Swift language releases, e.g. swift(>=2.2)
Detailed Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
Impact on Existing Code

This is purely additive

Alternatives Considered

I think it's unwise to replace OSX instead of adding macOS due to Apple's large and active userbase that may install Swift-sourced software and not upgrade to the latest operating system.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

(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.

···

On Jun 16, 2016, at 6:02 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

On Jun 16, 2016, at 9:55 AM, David Waite <david@alkaline-solutions.com <mailto:david@alkaline-solutions.com>> wrote:

-- Erica

On Jun 16, 2016, at 8:29 AM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@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

Aliasing the OS X Platform Configuration Test

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

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

These are excellent points. I've updated the alternatives considered section. Reload.

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.

-- E

···

On Jun 16, 2016, at 10:53 AM, Charlie Monroe <charlie@charliemonroe.net> wrote: