[swift-dev] [RFC] Finer grained OS checks

Erica Sadun erica at ericasadun.com
Mon Jul 11 11:56:55 CDT 2016

> On Jul 11, 2016, at 10:50 AM, Karl Wagner via swift-dev <swift-dev at swift.org> wrote:
> My thoughts:
> I don't like the idea of additional qualifiers after OS. Perhaps we could rename it something more generic like "SDK" or split the non-common stuff in to a seprarate module?
> As for the proposal (I know it's too late for Swift 3, but I read it so I might as well say what i thought about it):
> - I don't like "vendor"; it's too vague to give useful guarantees. Even the Apple platforms can be wildly different. I would prefer a group SDK target instead, like "mobileDarwin", or even something better than that (the "canImport" idea is even better - so you can test for the presence of frameworks such as UIKit directly, and the compiler will/should use @availability attributes to ensure it is safe for all of your deployment targets)
> - Also don't like the simulator condition variable. The iOS simulator is literally x86 iOS. If there was an x86 iPhone, theoretically your binaries would be compatible. The fact that it runs on a simulator instead of a real device is not such a vital distinction (or shouldn't be) that we need integrate it in the language. What would we do in the future if there ever was a real x86 iOS target?
> Sorry to give a list of stuff I don't like, but it's easier that way because the rest of it is good. Endianness, word-size and Interop availability are useful things to know and really are compile-time options, and as I said canImport is also a very good idea.
> Karl

`canImport` is already adopted. Feel free to implement:


-- E

More information about the swift-dev mailing list