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 #
___________________________________
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.
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 :
# 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.
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 #
___________________________________
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.
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.
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.