[swift-evolution] [META] Re-invigorating the compiler directive discussion

Erica Sadun erica at ericasadun.com
Mon Mar 14 13:48:05 CDT 2016


Question to everyone with regard to `#if platform()`:

Right now, I'm leaning towards tossing `#if platform()` since #if imports(Darwin) can universally distinguish Apple.
Is this something you support or oppose? If you're against, what platforms would you include in the test suite?

Right now, I'm leaning towards tossing `#if platform()` (it can be brought up again at some later date). Is this something you oppose or support?

-- E


> On Mar 14, 2016, at 12:20 PM, Goffredo Marocchi <panajev at gmail.com> wrote:
> 
> Go go go :)
> 
> Sent from my iPhone
> 
> On 14 Mar 2016, at 17:42, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>>> 
>>> On Mar 14, 2016, at 11:34 AM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>>> 
>>>> 
>>>> On Mar 14, 2016, at 10:33 AM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>>>> 
>>>> 
>>>>> On Mar 14, 2016, at 11:28 AM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>>>>> 
>>>>> 
>>>>>> On Mar 12, 2016, at 7:56 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>>>> 
>>>>>> #if platform(Apple) tests for platform families, including Apple, Linux, Unix, Windows
>>>>>> #if imports(UIKit) tests for framework support, differentiating, for example, Mac code from iOS and tvOS code.
>>>>>> #if target(simulator) and #if target(device) represent a common categorization requirement, such as Metal, Keychain, and AVFoundation Camera code. 
>>>>>> #if target(32bit) and #if target(64bit) tests for 32 and 64 bit architecture families. 
>>>>>> #if target(bigendian) and #if target(littleendian) tests for big and little endianness.
>>>>>> #if config(debug) tests for debug builds. 
>>>>> I agree that expanding our repertoire here is badly needed. I think it'd be better to have a specific #if foo(...) name for each combination of independent choices. It's a nice property of our current design that, when you see #if foo(X) || foo(Y), you know foo(X) and foo(Y) are mutually exclusive. You'd lose that if you had both target(32bit) and target(bigendian).
>>>>> 
>>>>> -Joe
>>>> 
>>>> Ah. I was trying to *reduce* the number of distinct fooities. 
>>>> 
>>>> #if bitwidth(32) and #if bitwidth(64) tests for 32 and 64 bit architecture families. 
>>>> #if endian(big) and #if endian(little) tests for big and little endianness.
>>>> better?
>>>> 
>>>> Also, should I break this up into distinct proposals or one core utility group?
>>> 
>>> IMO I'd split it up.
>>> 
>>> -Joe
>> 
>> Prepare for deluge. I'll hold off for a day or two just to see if anyone hates any of these or wants them tweaked or sees something else urgent to add.
>> Otherwise, there has been sufficient enthusiasm on a variety of threads and fora to give me confidence to kickstart 'em.
>> 
>> -- E
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160314/5c5b434d/attachment.html>


More information about the swift-evolution mailing list