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

Dany St-Amant dsa.mls at icloud.com
Thu Jun 16 18:34:56 CDT 2016


> Le 16 juin 2016 à 11:29, Charlie Monroe via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 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

> 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 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
>> 
>> 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 at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> 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/fb43b811/attachment.html>


More information about the swift-evolution mailing list