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

Jeff Kelley slaunchaman at gmail.com
Mon Mar 28 23:51:29 CDT 2016


Why would it have to compile under iOS? The “import Cocoa” bit is behind an else clause.


Jeff Kelley

SlaunchaMan at gmail.com | @SlaunchaMan <https://twitter.com/SlaunchaMan> | jeffkelley.org <http://jeffkelley.org/>
> On Mar 29, 2016, at 12:44 AM, Erica Sadun <erica at ericasadun.com> wrote:
> 
> On Mar 28, 2016, at 10:37 PM, Jeff Kelley via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> This might be crazy, but we could also reuse try here:
>> 
>> import Foundation
>> try import UIKit {
>> 	// UIKit Code
>> }
>> else try import Cocoa
>> 	// Cocoa Code
>> }
>> 
>> This would attempt to import UIKit and if it succeeded, run the code in the closure.
>> 
> 
> The problem with your approach is that the Cocoa code would have to compile under iOS and 
> I'm afraid that's a no-go. Build-configuration tests enable entire blocks of code to be removed
> from compilation.
> 
> -- E
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160329/56b8c7cb/attachment.html>


More information about the swift-evolution mailing list