What are the rules for including @ with attributes/keywords and the possibility of removing it

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

Brandon

Without the '@', you're declaring a parameter labeled 'autoclosure'.

-Joe

···

On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

What about “inout” then?

And duh! I completely forgot about parameter labels -_-

···

On Jan 11, 2016, at 1:14 PM, Joe Groff <jgroff@apple.com> wrote:

On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

Without the '@', you're declaring a parameter labeled 'autoclosure'.

-Joe

'inout' is a special case, and we've reserved it as a keyword. There's a thread about moving 'inout' to eliminate this special case.

-Joe

···

On Jan 11, 2016, at 10:17 AM, Brandon Knope <bknope@me.com> wrote:

On Jan 11, 2016, at 1:14 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

Without the '@', you're declaring a parameter labeled 'autoclosure'.

-Joe

What about “inout” then?

And duh! I completely forgot about parameter labels -_-

Ok thanks I’ll look into it! It may remove some confusion / unclarity for me

Brandon

···

On Jan 11, 2016, at 1:18 PM, Joe Groff <jgroff@apple.com> wrote:

On Jan 11, 2016, at 10:17 AM, Brandon Knope <bknope@me.com <mailto:bknope@me.com>> wrote:

On Jan 11, 2016, at 1:14 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

Without the '@', you're declaring a parameter labeled 'autoclosure'.

-Joe

What about “inout” then?

And duh! I completely forgot about parameter labels -_-

'inout' is a special case, and we've reserved it as a keyword. There's a thread about moving 'inout' to eliminate this special case.

-Joe

Hi,

I still would like to better understand that.

Is the reason to use `@` to hint the compiler / optimizer? Why not make `autoclosure`, `noescape`, etc. special keywords as well?

— A

···

On Jan 11, 2016, at 1:19 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Ok thanks I’ll look into it! It may remove some confusion / unclarity for me

Brandon

On Jan 11, 2016, at 1:18 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

On Jan 11, 2016, at 10:17 AM, Brandon Knope <bknope@me.com <mailto:bknope@me.com>> wrote:

On Jan 11, 2016, at 1:14 PM, Joe Groff <jgroff@apple.com <mailto:jgroff@apple.com>> wrote:

On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

@noescape
@autoclosure

Is there a particular reason why there is a @ prepending these attributes/keywords?

func test(@autoclosure test: () -> Bool) -> Void

vs.

func test(autoclosure test: () -> Bool) -> Void

It seems cleaner/clearer without @ sprinkled everywhere, but what is the rationale behind needing the @ symbol?

Without the '@', you're declaring a parameter labeled 'autoclosure'.

-Joe

What about “inout” then?

And duh! I completely forgot about parameter labels -_-

'inout' is a special case, and we've reserved it as a keyword. There's a thread about moving 'inout' to eliminate this special case.

-Joe

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