[swift-evolution] [Draft] Adding a Build Configuration Import Test
Erica Sadun
erica at ericasadun.com
Tue Mar 29 00:08:55 CDT 2016
`try` is a run-time call.
-- E
> On Mar 28, 2016, at 10:51 PM, Jeff Kelley <slaunchaman at gmail.com> wrote:
>
> Why would it have to compile under iOS? The “import Cocoa” bit is behind an else clause.
>
>
> Jeff Kelley
>
> SlaunchaMan at gmail.com <mailto: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 <mailto:erica at ericasadun.com>> wrote:
>>
>> On Mar 28, 2016, at 10:37 PM, Jeff Kelley via swift-evolution <swift-evolution at swift.org <mailto: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/20160328/fc04e3c4/attachment.html>
More information about the swift-evolution
mailing list