[Discussion] Replacing Equal Signs with Colons For Attribute Arguments

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.

Thoughts and feedback appreciated. Thank you, -- Erica

Wow, Erica, you're a machine. I meant to propose this but hadn't gotten around to writing it yet.

I agree that the version where you show an example is better. You might even want to do it before-and-after style, but that might be overkill.

It might also be a good idea to explicitly list the attributes affected by this change—that is, the ones that take labeled parameters. Again, this is not necessary to precisely define what's changing, but rather to help everyone evaluate the scope of the change. (It might be that @available and @warn_unused_results are the only ones; if so, the current wording doesn't make that clear enough.)

I'm obviously strongly in favor of this change, and I think this proposal is a great start; I just want to make sure it's expressed as clearly as possible so everyone will understand its relatively low impact. Keep up the good work!

···

--
Brent Royal-Gordon
Architechies

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

···

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

+1 nice additional consistency

···

On Wednesday, 17 February 2016, Erica Sadun via swift-evolution < swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

   - Proposal: TBD
   - Author(s): Erica Sadun <http://github.com/erica&gt;
   - Status: TBD
   - Review manager: TBD

<attributes.md · GitHub;
Introduction

Attribute arguments are unlike other Swift language arguments. At the call
site, they use = instead of colons to distinguish argument names from
passed values. This proposal brings attributes into compliance with Swift
standard practices by replacing the use of "=" with ":" in this one-off
case.

*Discussion took place on the Swift Evolution mailing list in the
[Discussion] Replacing Equal Signs with Colons For Attribute Arguments
thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for
suggesting this enhancement.*
<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with
keywords that constrain behavior. Recognizable by their at-sign
<http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features,
characteristics, restrictions, and expectations of types and declarations
to the Swift compiler. Common attributes include @noescape for parameters
that cannot outlive the lifetime of a call, @convention, to indicates
whether a type's calling conventions follows a Swift, C, or (Objective-C)
block model, and @available to enumerate a declaration's compatibility
with platform and OS versions. Swift currently offers about a dozen
distinct attributes, and is likely to expand this vocabulary in future
language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments)
including @available and @warn_unused_result. In the current grammar, an
equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name

Using = is out of step with other Swift parameterization call-site
patterns. Tweaking the grammar to match the rest of Swift introduces a
small change that adds consistency across the language.

parameter name: parameter value

<attributes.md · GitHub
Design

This proposal replaces the use of = with : in the balanced tokens used to
compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value

This design can be summarized as "wherever current Swift attributes use =,
use : instead".

<attributes.md · GitHub
Considered
There are no alternatives to put forth other than not accepting this
proposal.

--
-- Howard.

+1 here too!

···

Sent from my iPhone

On 16 Feb 2016, at 23:42, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun
Status: TBD
Review manager: TBD
Introduction

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor for suggesting this enhancement.

Motivation

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
Detail Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

Alternatives Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I’m a +1 for this; it’s a simple change with no side-effects, and consistency is a good thing!

···

On 16 Feb 2016, at 22:42, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

···

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com <mailto:rparada@mac.com>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

-- Erica

···

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")
typealias MyProtocol = MyRenamedProtocol

@warn_unused_result(mutable_variant: "sortInPlace")
public func sort() -> [Self.Generator.Element]

@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")
public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

···

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com <mailto:rparada@mac.com>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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 <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

It looks very good.

Thank you Erica.

···

On Feb 16, 2016, at 8:05 PM, Erica Sadun <erica@ericasadun.com> wrote:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")
typealias MyProtocol = MyRenamedProtocol

@warn_unused_result(mutable_variant: "sortInPlace")
public func sort() -> [Self.Generator.Element]

@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")
public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com <mailto:crk@akkyra.com>> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com <mailto:rparada@mac.com>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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 <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

+1, nice consistency

···

On Wednesday, 17 February 2016, Erica Sadun via swift-evolution < swift-evolution@swift.org> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible*
is already in there under motivation. Just sub out each "=" for ":" and you
have the entire extent of the change.

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com > <javascript:_e(%7B%7D,'cvml','rparada@mac.com');>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I
would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution < > swift-evolution@swift.org > <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

   - Proposal: TBD
   - Author(s): Erica Sadun <http://github.com/erica&gt;
   - Status: TBD
   - Review manager: TBD

<attributes.md · GitHub;
Introduction

Attribute arguments are unlike other Swift language arguments. At the call
site, they use = instead of colons to distinguish argument names from
passed values. This proposal brings attributes into compliance with Swift
standard practices by replacing the use of "=" with ":" in this one-off
case.

*Discussion took place on the Swift Evolution mailing list in the
[Discussion] Replacing Equal Signs with Colons For Attribute Arguments
thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for
suggesting this enhancement.*
<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with
keywords that constrain behavior. Recognizable by their at-sign
<http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features,
characteristics, restrictions, and expectations of types and declarations
to the Swift compiler. Common attributes include @noescape for parameters
that cannot outlive the lifetime of a call, @convention, to indicates
whether a type's calling conventions follows a Swift, C, or (Objective-C)
block model, and @available to enumerate a declaration's compatibility
with platform and OS versions. Swift currently offers about a dozen
distinct attributes, and is likely to expand this vocabulary in future
language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments)
including @available and @warn_unused_result. In the current grammar, an
equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name

Using = is out of step with other Swift parameterization call-site
patterns. Tweaking the grammar to match the rest of Swift introduces a
small change that adds consistency across the language.

parameter name: parameter value

<attributes.md · GitHub
Design

This proposal replaces the use of = with : in the balanced tokens used to
compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value

This design can be summarized as "wherever current Swift attributes use =,
use : instead".

<attributes.md · GitHub
Considered
There are no alternatives to put forth other than not accepting this
proposal.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
<javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>
https://lists.swift.org/mailman/listinfo/swift-evolution

+1 to the proposal

-Thorsten

···

Am 17.02.2016 um 02:05 schrieb Erica Sadun via swift-evolution <swift-evolution@swift.org>:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")
typealias MyProtocol = MyRenamedProtocol

@warn_unused_result(mutable_variant: "sortInPlace")
public func sort() -> [Self.Generator.Element]

@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")
public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun
Status: TBD
Review manager: TBD
Introduction

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor for suggesting this enhancement.

Motivation

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
Detail Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

Alternatives Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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

I'm +1 as well, this would be the last place an equals sign is used not in the context of assignment.

Pozdrawiam – Regards,
Adrian Kashivskyy

···

Wiadomość napisana przez Haravikk via swift-evolution <swift-evolution@swift.org> w dniu 23.02.2016, o godz. 09:48:

I’m a +1 for this; it’s a simple change with no side-effects, and consistency is a good thing!

On 16 Feb 2016, at 22:42, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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

Aren’t we removing the use of snake case in Swift 3? So should @warn_unused_result be de-snake-cased?

···

On Feb 16, 2016, at 6:45 PM, Ricardo Parada via swift-evolution <swift-evolution@swift.org> wrote:

It looks very good.

Thank you Erica.

On Feb 16, 2016, at 8:05 PM, Erica Sadun <erica@ericasadun.com <mailto:erica@ericasadun.com>> wrote:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")
typealias MyProtocol = MyRenamedProtocol

@warn_unused_result(mutable_variant: "sortInPlace")
public func sort() -> [Self.Generator.Element]

@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")
public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com <mailto:crk@akkyra.com>> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com <mailto:rparada@mac.com>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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 <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

That's beyond the scope of this proposal. If you want to discuss it, I encourage you to start a separate thread.

-- E

···

On Feb 16, 2016, at 7:54 PM, Michael Wells <michael@michaelwells.com> wrote:

Aren’t we removing the use of snake case in Swift 3? So should @warn_unused_result be de-snake-cased?

On Feb 16, 2016, at 6:45 PM, Ricardo Parada via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

It looks very good.

Thank you Erica.

On Feb 16, 2016, at 8:05 PM, Erica Sadun <erica@ericasadun.com <mailto:erica@ericasadun.com>> wrote:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")
typealias MyProtocol = MyRenamedProtocol

@warn_unused_result(mutable_variant: "sortInPlace")
public func sort() -> [Self.Generator.Element]

@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")
public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com <mailto:crk@akkyra.com>> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible* is already in there under motivation. Just sub out each "=" for ":" and you have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol, attribute-name, parens, attribute argument label and example attribute arguments. There are no full examples in the proposal of either the existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to evaluate how it will actually look in practice. (Yes, we could look up a few and type them in somewhere ourselves, but it would be nice to have them in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com <mailto:rparada@mac.com>> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

Proposal: TBD
Author(s): Erica Sadun <http://github.com/erica&gt;
Status: TBD
Review manager: TBD
<attributes.md · GitHub

Attribute arguments are unlike other Swift language arguments. At the call site, they use = instead of colons to distinguish argument names from passed values. This proposal brings attributes into compliance with Swift standard practices by replacing the use of "=" with ":" in this one-off case.

Discussion took place on the Swift Evolution mailing list in the [Discussion] Replacing Equal Signs with Colons For Attribute Arguments thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for suggesting this enhancement.

<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with keywords that constrain behavior. Recognizable by their at-sign <http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features, characteristics, restrictions, and expectations of types and declarations to the Swift compiler. Common attributes include @noescape for parameters that cannot outlive the lifetime of a call, @convention, to indicates whether a type's calling conventions follows a Swift, C, or (Objective-C) block model, and @available to enumerate a declaration's compatibility with platform and OS versions. Swift currently offers about a dozen distinct attributes, and is likely to expand this vocabulary in future language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments) including @available and @warn_unused_result. In the current grammar, an equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name
Using = is out of step with other Swift parameterization call-site patterns. Tweaking the grammar to match the rest of Swift introduces a small change that adds consistency across the language.

parameter name: parameter value
<attributes.md · GitHub Design

This proposal replaces the use of = with : in the balanced tokens used to compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value
This design can be summarized as "wherever current Swift attributes use =, use : instead".

<attributes.md · GitHub Considered

There are no alternatives to put forth other than not accepting this proposal.
_______________________________________________
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 <mailto:swift-evolution@swift.org>
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

+1 from me for proposal

···

On Feb 17, 2016 4:33 AM, "Erica Sadun via swift-evolution" < swift-evolution@swift.org> wrote:

That's beyond the scope of this proposal. If you want to discuss it, I
encourage you to start a separate thread.

-- E

On Feb 16, 2016, at 7:54 PM, Michael Wells <michael@michaelwells.com> > wrote:

Aren’t we removing the use of snake case in Swift 3? So should
@warn_unused_result be de-snake-cased?

On Feb 16, 2016, at 6:45 PM, Ricardo Parada via swift-evolution < > swift-evolution@swift.org> wrote:

It looks very good.

Thank you Erica.

On Feb 16, 2016, at 8:05 PM, Erica Sadun <erica@ericasadun.com> wrote:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")typealias MyProtocol = MyRenamedProtocol
@warn_unused_result(mutable_variant: "sortInPlace")public func sort() -> [Self.Generator.Element]
@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution < > swift-evolution@swift.org> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible*
is already in there under motivation. Just sub out each "=" for ":" and you
have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol,
attribute-name, parens, attribute argument label and example attribute
arguments. There are no full examples in the proposal of either the
existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to
evaluate how it will actually look in practice. (Yes, we could look up a
few and type them in somewhere ourselves, but it would be nice to have them
in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I
would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution < > swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

   - Proposal: TBD
   - Author(s): Erica Sadun <http://github.com/erica&gt;
   - Status: TBD
   - Review manager: TBD

<attributes.md · GitHub;
Introduction

Attribute arguments are unlike other Swift language arguments. At the call
site, they use = instead of colons to distinguish argument names from
passed values. This proposal brings attributes into compliance with Swift
standard practices by replacing the use of "=" with ":" in this one-off
case.

*Discussion took place on the Swift Evolution mailing list in the
[Discussion] Replacing Equal Signs with Colons For Attribute Arguments
thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for
suggesting this enhancement.*
<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with
keywords that constrain behavior. Recognizable by their at-sign
<http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features,
characteristics, restrictions, and expectations of types and declarations
to the Swift compiler. Common attributes include @noescape for parameters
that cannot outlive the lifetime of a call, @convention, to indicates
whether a type's calling conventions follows a Swift, C, or (Objective-C)
block model, and @available to enumerate a declaration's compatibility
with platform and OS versions. Swift currently offers about a dozen
distinct attributes, and is likely to expand this vocabulary in future
language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments)
including @available and @warn_unused_result. In the current grammar, an
equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name

Using = is out of step with other Swift parameterization call-site
patterns. Tweaking the grammar to match the rest of Swift introduces a
small change that adds consistency across the language.

parameter name: parameter value

<attributes.md · GitHub
Design

This proposal replaces the use of = with : in the balanced tokens used to
compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value

This design can be summarized as "wherever current Swift attributes use =,
use : instead".

<attributes.md · GitHub
Considered
There are no alternatives to put forth other than not accepting this
proposal.
_______________________________________________
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

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

+1 from me as well

···

On Wed, Feb 17, 2016 at 12:08 PM, Thorsten Seitz via swift-evolution < swift-evolution@swift.org> wrote:

+1 to the proposal

-Thorsten

Am 17.02.2016 um 02:05 schrieb Erica Sadun via swift-evolution < > swift-evolution@swift.org>:

Adding:

@available(*, unavailable, renamed: "MyRenamedProtocol")typealias MyProtocol = MyRenamedProtocol
@warn_unused_result(mutable_variant: "sortInPlace")public func sort() -> [Self.Generator.Element]
@available(*, deprecated, message: "it will be removed in Swift 3. Use the 'generate()' method on the collection.")public init(_ bounds: Range<Element>)

gist: attributes.md · GitHub

-- E

On Feb 16, 2016, at 5:43 PM, Charles Kissinger <crk@akkyra.com> wrote:

On Feb 16, 2016, at 4:08 PM, Erica Sadun via swift-evolution < > swift-evolution@swift.org> wrote:

Ricardo,

This proposal is so narrow that I believe *every single example possible*
is already in there under motivation. Just sub out each "=" for ":" and you
have the entire extent of the change.

Hi Erica,

I think Ricardo means full examples of the new style, including @ symbol,
attribute-name, parens, attribute argument label and example attribute
arguments. There are no full examples in the proposal of either the
existing or proposed style.

It might seem nit-picky (and it is :-)), but that’s the only way for us to
evaluate how it will actually look in practice. (Yes, we could look up a
few and type them in somewhere ourselves, but it would be nice to have them
in the proposal.)

—CK

-- Erica

On Feb 16, 2016, at 5:03 PM, Ricardo Parada <rparada@mac.com> wrote:

Hi Erica,

I understand this is a draft and even though it may be obvious to many, I
would add a few examples with the proposed solution.

Thanks
Ricardo Parada

On Feb 16, 2016, at 5:42 PM, Erica Sadun via swift-evolution < > swift-evolution@swift.org> wrote:

Thoughts and feedback appreciated. Thank you, -- Erica

Replacing Equal Signs with Colons For Attribute Arguments

   - Proposal: TBD
   - Author(s): Erica Sadun <http://github.com/erica&gt;
   - Status: TBD
   - Review manager: TBD

<attributes.md · GitHub;
Introduction

Attribute arguments are unlike other Swift language arguments. At the call
site, they use = instead of colons to distinguish argument names from
passed values. This proposal brings attributes into compliance with Swift
standard practices by replacing the use of "=" with ":" in this one-off
case.

*Discussion took place on the Swift Evolution mailing list in the
[Discussion] Replacing Equal Signs with Colons For Attribute Arguments
thread. Thanks to Doug Gregor <https://github.com/DougGregor&gt; for
suggesting this enhancement.*
<attributes.md · GitHub

Attributes enable developers to annotate declarations and types with
keywords that constrain behavior. Recognizable by their at-sign
<http://foldoc.org/strudel&gt; "@" prefix, attributes communicate features,
characteristics, restrictions, and expectations of types and declarations
to the Swift compiler. Common attributes include @noescape for parameters
that cannot outlive the lifetime of a call, @convention, to indicates
whether a type's calling conventions follows a Swift, C, or (Objective-C)
block model, and @available to enumerate a declaration's compatibility
with platform and OS versions. Swift currently offers about a dozen
distinct attributes, and is likely to expand this vocabulary in future
language updates.

Some attributes accept arguments: @attribute-name(attribute-arguments)
including @available and @warn_unused_result. In the current grammar, an
equal sign separates attribute argument keywords from values:

introduced=version-number
deprecated=version-number
obsoleted=version-number
message=message
renamed=new-name
mutable_variant=method-name

Using = is out of step with other Swift parameterization call-site
patterns. Tweaking the grammar to match the rest of Swift introduces a
small change that adds consistency across the language.

parameter name: parameter value

<attributes.md · GitHub
Design

This proposal replaces the use of = with : in the balanced tokens used to
compose an attribute argument clause along the following lines:

attribute → @ attribute-name attribute-argument-clause<sub>opt</sub>
attribute-name → identifier
attribute-argument-clause → ( balanced-tokens<sub>opt<opt> )
balanced-tokens → balanced-token
balanced-tokens → balanced-token, balanced-tokens
balanced-token → attribute-argument-label : attribute argument-value

This design can be summarized as "wherever current Swift attributes use =,
use : instead".

<attributes.md · GitHub
Considered
There are no alternatives to put forth other than not accepting this
proposal.
_______________________________________________
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

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

--
Trent Nadeau