[swift-evolution] [Discussion] Modernizing Attribute Case and Attribute Argument Naming

Erica Sadun erica at ericasadun.com
Wed Feb 17 12:34:16 CST 2016


No worries.

And I have updated the accompanying gist with a better example. Thank you.

https://gist.github.com/erica/29c1a7fb7f49324d572f <https://gist.github.com/erica/29c1a7fb7f49324d572f>

-- Erica

> On Feb 17, 2016, at 11:33 AM, Michael Wells <michael at michaelwells.com> wrote:
> 
> Apologies. I didn’t read that very carefully. 
> 
> -mw
> 
>> On Feb 17, 2016, at 10:29 AM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>> 
>> Michael, 
>> 
>> mutableVariant is an argument label, not an attribute name:
>> 
>> @warn_unused_result(message: "message", mutable_variant: "doThisThingInPlace")
>> 
>> becomes
>> 
>> @warnunusedresult(message: "message", mutableVariant: "doThisThingInPlace")
>> 
>> -- E
>> 
>> 
>>> On Feb 17, 2016, at 11:26 AM, Michael Wells <michael at michaelwells.com <mailto:michael at michaelwells.com>> wrote:
>>> 
>>> Many thanks for writing this up. One nit-pick is mutableVariant should be mutablevariant.
>>> 
>>> I’m so happy that there are folks out there that care about these things. :)
>>> 
>>> -mw
>>> 
>>>> On Feb 17, 2016, at 10:18 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>> 
>>>> For your consideration: Attribute Ophidiophobia. Feedback and suggestions welcome. -- Erica
>>>> 
>>>> Modernizing Attribute Case and Attribute Argument Naming
>>>> 
>>>> Proposal: TBD
>>>> Author(s): Erica Sadun <http://github.com/erica>
>>>> Status: TBD
>>>> Review manager: TBD
>>>> 
>>>>  <https://gist.github.com/erica/29c1a7fb7f49324d572f#introduction>Introduction
>>>> 
>>>> Two isolated instances of snake case remain in the Swift attribute grammar. This proposal updates those elements to bring them into compliance with modern Swift language standards. 
>>>> 
>>>> The Swift-Evolution discussion of this topic took place in the "[Discussion] Modernizing Attribute Case and Attribute Argument Naming" thread. Hat tip to Michael Wells
>>>> 
>>>> 
>>>>  <https://gist.github.com/erica/29c1a7fb7f49324d572f#motivation-and-detail-design>Motivation and Detail Design
>>>> 
>>>> Parts of the Swift attribute grammar retain lower snake case patterns that no longer match modern conventions:
>>>> 
>>>> The warn_unused_result attribute should use lowercase and be renamed warnunusedresult. The lower case pattern matches other compound attribute examples: autoclosure, objc, noescape, nonobjc, and noreturn.
>>>> The mutable_variant attribute argument should use lower camel case as is standard for native Swift argument labels and be renamed to mutableVariant.
>>>> Some non-native Swift attributes use a distinct pattern that does not apply to this proposal, specificallyUIApplicationMain, NSManaged, NSCopying, NSApplicationMain and do not fall under the scope of the native Swift lowercase convention.
>>>> 
>>>> 
>>>>  <https://gist.github.com/erica/29c1a7fb7f49324d572f#alternatives-considered>Alternatives Considered
>>>> 
>>>> There are no alternatives for this proposal.
>>>> 
>>>> _______________________________________________
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160217/a7a27e44/attachment.html>


More information about the swift-evolution mailing list