[swift-evolution] What are the rules for including @ with attributes/keywords and the possibility of removing it

Joe Groff jgroff at apple.com
Mon Jan 11 12:18:41 CST 2016


> On Jan 11, 2016, at 10:17 AM, Brandon Knope <bknope at me.com> wrote:
> 
> 
>> On Jan 11, 2016, at 1:14 PM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>> 
>> 
>>> On Jan 11, 2016, at 9:49 AM, Brandon Knope via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160111/e1f6eacf/attachment.html>


More information about the swift-evolution mailing list