[DRAFT]


(Erica Sadun) #1

Gist: https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica>
Status: TBD
Review manager: TBD
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#introduction>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 <applewebdata://114FBEA2-1A00-454D-8B39-5560E5F1B536>
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#motivation>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.

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#current-art>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)
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#detailed-design>Detailed Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#impact-on-existing-code>Impact on Existing Code

This is purely additive

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#alternatives-considered>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.


(David Waite) #2

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:20 AM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Gist: https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica>
Status: TBD
Review manager: TBD
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#introduction>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 <applewebdata://54A6C9FB-5044-4BCE-9847-704C3D06AEB7>
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#motivation>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.

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#current-art>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)
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#detailed-design>Detailed Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#impact-on-existing-code>Impact on Existing Code

This is purely additive

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#alternatives-considered>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


(Erica Sadun) #3

First apologies because I clearly messed up when sending. So can you re-ask your question on the version of this thread that isn't [DRAFT] followed by blank?

Second, I do not anticipate deprecating osx because Swift will/can be deployed to OS X as well as macOS. I'll answer on the other thread too, so there's a clear record of discussion for archival retrieval.

Thanks (and sorry),

-- E

···

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

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:20 AM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Gist: https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2

Aliasing the OS X Platform Configuration Test

Proposal: TBD
Author: Erica Sadun <http://github.com/erica>
Status: TBD
Review manager: TBD
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#introduction>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 <applewebdata://FCACDB80-68FD-4D33-923C-BE99D1171DBF>
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#motivation>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.

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#current-art>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)
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#detailed-design>Detailed Design

  if (Target.isMacOSX()) {
    addPlatformConditionValue("os", "OSX");
    addPlatformConditionValue("os", "macOS");
  }
<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#impact-on-existing-code>Impact on Existing Code

This is purely additive

<https://gist.github.com/erica/f53fa6cfef9e5cf17ab139f7528edde2#alternatives-considered>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 <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution