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

Joe Groff jgroff at apple.com
Mon Mar 14 12:34:57 CDT 2016


> On Mar 14, 2016, at 10:33 AM, Erica Sadun <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

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


More information about the swift-evolution mailing list