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

2016-05-13 Thread Pyry Jahkola via swift-evolution
> On 13 May 2016, Erica Sadun wrote: > >> As per Pyry’s feedback, you could add a version: >> >> #if import Frobnication(<1.7.3) // <- Only added version constraint here. >> extension Knob : Frobnicatable { ... } >> #endif > > I have no problem with this but would need to defer to the build and

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

2016-05-13 Thread Erica Sadun via swift-evolution
> On May 13, 2016, at 1:42 AM, Patrick Smith wrote: > >> canImport (or whatever it ends up being called) is deliberate. >> >> You test before you import: >> >> #if canImport(x) >> import x >> #else >> ... >> #endif >> >> and you test at the use-site >> >> #if canImport(x) >> // use things

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

2016-05-13 Thread Patrick Smith via swift-evolution
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

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

2016-05-13 Thread Patrick Smith via swift-evolution
Well my idea also included module(X), modelled after the os() function, e.g. #if os(OSX) #if import UIKit // Some UIKit-related declarations #endif // Later in the same file func f() { #if module(UIKit) // Use UIKit-only declarations #endif } Looking forw

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

2016-05-13 Thread Gwendal Roué via swift-evolution
> Le 13 mai 2016 à 11:05, Pyry Jahkola a écrit : > >> Gwendal Roué wrote: >> >> `#if import Foo` can not deal with the fact that a single source file may >> have to perform the importability test several times. > > This would be less of a problem if conditional imports like that worked > loc

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

2016-05-13 Thread Pyry Jahkola via swift-evolution
> Gwendal Roué wrote: > > `#if import Foo` can not deal with the fact that a single source file may > have to perform the importability test several times. 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 fo

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

2016-05-13 Thread Gwendal Roué via swift-evolution
Hello, `#if import Foo` can not deal with the fact that a single source file may have to perform the importability test several times. For example: #if canImport(UIKit) import UIKit // Some UIKit-related declarations #endif // Later in the

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

2016-05-13 Thread Pyry Jahkola via swift-evolution
Patrick, I think you're making valuable points here. I also can't think of cases where you wouldn't also import a module in case it was found to be importable. So the use cases I can think of could as well be tackled by allowing expressions such as `import Foo.Bar` as compile-time checks within

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

2016-05-13 Thread Patrick Smith via swift-evolution
> canImport (or whatever it ends up being called) is deliberate. > > You test before you import: > > #if canImport(x) >import x > #else > ... > #endif > > and you test at the use-site > > #if canImport(x) > // use things that are available in x > #else > ... > > So you don't import UIKit

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

2016-05-13 Thread Krzysztof Siejkowski via swift-evolution
* What is your evaluation of the proposal? +1. It attacks a real problem that is met regularly when working on multi-platform code. I also like `canImport`. As it’s gonna be used mostly after #if, the whole statement becomes very readable. * Is the problem being addressed significant enough

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

2016-05-13 Thread Pyry Jahkola via swift-evolution
> The review of "SE-0075: Adding a Build Configuration Import Test" begins now > and runs through May 16. The proposal is available here: > > > https://github.com/apple/swift-evolution/blob/master/proposals/0075-import-test.md > > * What is your evaluation of the proposal? +1, I th

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

2016-05-12 Thread Erica Sadun via swift-evolution
> On May 12, 2016, at 7:30 PM, Dany St-Amant via swift-evolution > wrote: > > >> On May 10, 2016, at 2:49 PM, Chris Lattner via swift-evolution >> wrote: >> >> Hello Swift community, >> >> The review of "SE-0075: Adding a Build Configuration Import Test" begins now >> and runs through May

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

2016-05-12 Thread Dany St-Amant via swift-evolution
> On May 10, 2016, at 2:49 PM, Chris Lattner via swift-evolution > wrote: > > Hello Swift community, > > The review of "SE-0075: Adding a Build Configuration Import Test" begins now > and runs through May 16. The proposal is available here: > > > https://github.com/apple/swift-evolution/bl

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

2016-05-10 Thread Xiaodi Wu via swift-evolution
> * What is your evaluation of the proposal? > +1, solves a useful problem on the horizon. > * Is the problem being addressed significant enough to warrant a > change to Swift? > Yes. > * Does this proposal fit well with the feel and direction of Swift? > Yes. Althoug

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

2016-05-10 Thread David Hart via swift-evolution
> * What is your evaluation of the proposal? I think the proposal is worthwhile and I see myself using those when writing multiplatform code. I agree that they are much less brittle than os tests. > * Is the problem being addressed significant enough to warrant a change > to Swift?

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

2016-05-10 Thread Chris Lattner via swift-evolution
Hello Swift community, The review of "SE-0075: Adding a Build Configuration Import Test" begins now and runs through May 16. The proposal is available here: https://github.com/apple/swift-evolution/blob/master/proposals/0075-import-test.md Reviews are an important part of the Swift evo