[swift-evolution] [Review] SE-0075: Adding a Build Configuration Import Test

Patrick Smith pgwsmith at gmail.com
Fri May 13 05:57:07 CDT 2016


I can’t decide if this would be a good idea or not? I can see pluses and minuses!

+
Consistent.
One way to remember to work with modules.
Reinforces the rule that if you want to work with a module, you want to import it.

-
Could get confusing exactly where things are being imported, but you can stick an import away from the top of file today.


I imagine might still need something like `#if module(UIKit)` for certain scenarios, but not sure.


Patrick


> On 13 May 2016, at 7:05 PM, Pyry Jahkola via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This would be less of a problem if conditional imports like that worked locally in all scopes of code, so you could write just
> 
>     func foo() {
>         #if import UIKit
>             // Actually use UIKit...
>         #endif
>         // UIKit no longer visible.
>     }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160513/1e98e6c9/attachment.html>


More information about the swift-evolution mailing list