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 #endif I also want to mention other forms for further discussion: #if import Foo.Bar as FooBar #endif #if !import Foo #endif Pierre Le 23 mars 2016 à 08:21, Brent Royal-Gordon <[email protected]> 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 > _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
