[swift-evolution] [Draft] Adding a Build Configuration Import Test

Pierre Monod-Broca pierremonodbroca at gmail.com
Wed Mar 23 03:23:20 CDT 2016

Good points.

Should we allow the following then? And then should Bar be imported if Baz is not present?

#if import Foo.Bar && import Foo.Baz

I also want to mention other forms for further discussion:

#if import Foo.Bar as FooBar

#if !import Foo


Le 23 mars 2016 à 08:21, Brent Royal-Gordon <brent at architechies.com> a écrit :

>> My guess is most often one will want to import exactly what one is testing (Brent example) but I guess it would be very handy to do something like
>> #if canImport(Foo)
>>   import Foo.Bar as FooBar
>> #endif
> I don't see any particular reason you couldn't support anything `import` can support in an `#if import`.
>> Also +1 on Haraviks point:
>>> My only question is whether there should be a way to test minimum module versions? If I add support for a module but target a particularly recent version then that support won’t compile for platforms with older versions of the same module, so I should be able to prevent them from being a match.
> I think we'd be better off extending our existing `@available` and `#availability` mechanisms to test module versions in addition to platform versions. Two small, orthogonal features are better than one big, confused one.
> -- 
> Brent Royal-Gordon
> Architechies

More information about the swift-evolution mailing list