This was deliberate, and came from the pain of bringing up tvOS (and watchOS). 
Clang actually had a hack to treat “available on iOS” as “available on tvOS” 
for a while because of this. When you port something to a new platform, 
presumably everything that’s been introduced so far should be available from 
the start.

If we introduced a limited availability attribute, I think we’d want to make it 
more verbose than the normal one, so that you know you’re choosing it.

Jordan


> On May 25, 2016, at 20:18, Jacob Bandes-Storch <jtban...@gmail.com> wrote:
> 
> Was this an intentional choice, or is it just a temporary limitation? Would a 
> proposal to allow something like "@available(OS X 10.11)" be welcomed?
> 
> 
> On Wed, May 25, 2016 at 8:17 PM, Jordan Rose via swift-evolution 
> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
> The “*” in @available means “all other platforms”. If you want to mark 
> something unavailable on a particular platform, you’ll have to use the long 
> form of the @available attribute. There’s currently no way to mark something 
> “only available on these platforms”.
> 
> Jordan
> 
>> On May 25, 2016, at 18:48, Stuart Breckenridge via swift-evolution 
>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>> 
>> Presently, you can mark enum cases as @available but it has no impact. Take 
>> the following example:
>> 
>> enum Things:String {
>>      @available (iOS 9.3, *) case MobileThing = "com.example.mobilething"
>>      @available (OSX 10.11, *) case DesktopThing = "com.example.desktopthing"
>> }
>> 
>> Despite the above compiling, the following code will run iOS with no 
>> warnings:
>> 
>> func takesA(thing:Things) {
>>      print(thing)
>> }
>> 
>> takesA(.DesktopThing)
>> 
>> 
>> Are there enough compelling use-cases for @available on enum cases to be 
>> considered? At the very least, if @available doesn't do anything on cases, 
>> it shouldn't be permitted.
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution 
>> <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution 
> <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to