@avaliable and #avaliable

How come avaliable sometimes has a @ and a #

···

*___________________________________*

*James⎥Lead Engineer*

*james@supmenow.com <james@supmenow.com>⎥supmenow.com <http://supmenow.com>*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *

It depends it you talk about the @vailable attribute used to annotate methods, or the #available runtime check used to choose a code path depending the OS version.

···

Le 4 févr. 2016 à 16:05, James Campbell via swift-evolution <swift-evolution@swift.org> a écrit :

How come avaliable sometimes has a @ and a #
___________________________________

James⎥Lead Engineer

james@supmenow.com <mailto:james@supmenow.com>⎥supmenow.com <http://supmenow.com/&gt;
Sup

Runway East >

10 Finsbury Square

London

> EC2A 1AF

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

Worth watching this session from WWDC '15 - the first 20 minutes covers checking and using APIs for availability using @available and #available:

  WWDC15 - Videos - Apple Developer

Cheers,
M.

···

On 4 Feb 2016, at 23:05, James Campbell via swift-evolution <swift-evolution@swift.org> wrote:

How come avaliable sometimes has a @ and a #

--
Mark Glossop
E: lists <mailto:lists@cueballcentral.com>@cueballcentral.com <mailto:tech@cueballcentral.com>
TW: http://twitter.com/Cueball_AU

Just in general. I've been told that # is being seen as a convention for
the compiler to treat it like a macro but we have @avaliable and you're
saying #avaliable isn't even a compiler check.

···

*___________________________________*

*James⎥Lead Engineer*

*james@supmenow.com <james@supmenow.com>⎥supmenow.com <http://supmenow.com>*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *

On Thu, Feb 4, 2016 at 3:48 PM, Jean-Daniel Dupas <mailing@xenonium.com> wrote:

It depends it you talk about the @vailable attribute used to annotate
methods, or the #available runtime check used to choose a code path
depending the OS version.

Le 4 févr. 2016 à 16:05, James Campbell via swift-evolution < > swift-evolution@swift.org> a écrit :

How come avaliable sometimes has a @ and a #

*___________________________________*

*James⎥Lead Engineer*

*james@supmenow.com <james@supmenow.com>⎥supmenow.com
<http://supmenow.com/&gt;\*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

# as seen a convention for compiler generated code. #line expands to a String, #available expands to a runtime check that represent a bool.

I don’t see what’s wrong with that.

···

Le 4 févr. 2016 à 16:53, James Campbell via swift-evolution <swift-evolution@swift.org> a écrit :

Just in general. I've been told that # is being seen as a convention for the compiler to treat it like a macro but we have @avaliable and you're saying #avaliable isn't even a compiler check.

___________________________________

James⎥Lead Engineer

james@supmenow.com <mailto:james@supmenow.com>⎥supmenow.com <http://supmenow.com/&gt;
Sup

Runway East >

10 Finsbury Square

London

> EC2A 1AF

On Thu, Feb 4, 2016 at 3:48 PM, Jean-Daniel Dupas <mailing@xenonium.com <mailto:mailing@xenonium.com>> wrote:
It depends it you talk about the @vailable attribute used to annotate methods, or the #available runtime check used to choose a code path depending the OS version.

Le 4 févr. 2016 à 16:05, James Campbell via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> a écrit :

How come avaliable sometimes has a @ and a #
___________________________________

James⎥Lead Engineer

james@supmenow.com <mailto:james@supmenow.com>⎥supmenow.com <http://supmenow.com/&gt;
Sup

Runway East >>

10 Finsbury Square

London

>> EC2A 1AF

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

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

Right. @available doesn't do anything at run time; it just lets the compiler enforce availability restrictions. Additionally, it's attached to a particular declaration, so it fits in the existing attribute model.

#available, on the other hand, can turn into a dynamic check, and it can happen anywhere in code. It's not just a dynamic check, though; it also participates in the compiler's availability model. So we needed a new kind of thing that could handle this use case.

Hope that helps clear things up.

Jordan

···

On Feb 4, 2016, at 8:02 , Jean-Daniel Dupas via swift-evolution swift-evolution@swift.org wrote:

as seen a convention for compiler generated code. #line expands to a String, #available expands to a runtime check that represent a bool.

I don’t see what’s wrong with that.

Le 4 févr. 2016 à 16:53, James Campbell via swift-evolution swift-evolution@swift.org a écrit :

Just in general. I've been told that # is being seen as a convention for the compiler to treat it like a macro but we have @avaliable and you're saying #avaliable isn't even a compiler check.

___________________________________

James⎥Lead Engineer

james@supmenow.com⎥supmenow.com

Sup

**Runway East **

10 Finsbury Square

London

** EC2A 1AF **

On Thu, Feb 4, 2016 at 3:48 PM, Jean-Daniel Dupas mailing@xenonium.com wrote:

It depends it you talk about the @vailable attribute used to annotate methods, or the #available runtime check used to choose a code path depending the OS version.

Le 4 févr. 2016 à 16:05, James Campbell via swift-evolution swift-evolution@swift.org a écrit :

How come avaliable sometimes has a @ and a #
___________________________________

James⎥Lead Engineer

james@supmenow.com⎥supmenow.com

Sup

**Runway East **

10 Finsbury Square

London

** EC2A 1AF **


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


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


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