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

Erica Sadun erica at ericasadun.com
Wed Feb 17 19:04:26 CST 2016


Agreed that Attribute names are not types but they have a precedent (as you see in the proposal here: https://gist.github.com/erica/29c1a7fb7f49324d572f) of upper camel among their items.

-- E


> On Feb 17, 2016, at 12:35 PM, David Waite <david at alkaline-solutions.com> wrote:
> 
> If you are taking votes, I would say lower camel case (since the attribute names are not types).
> 
> Visually I dislike @objC and @nonObjC, but there’s already a discussion ongoing about how to deal with abbreviations in names.
> 
> -DW
> 
>> On Feb 17, 2016, at 11:43 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Do you have an alternative suggestion? I can add the following to the Alternatives Considered:
>> 
>> Using lowercase for attributes names becomes confusing with longer compound examples. For example `warnunusedresult`
>> looks a lot like a continuous string of lowercase characters. I recommend the Swift team consider introducing upper camel case
>> for attributes to match the Cocoa members (UIApplicationMain, NSManaged, NSCopying, NSApplicationMain, IBAction, IBDesignable, IBInspectable, IBOutlet) or lower
>> camel case to avoid this issue:
>> 
>> @AutoClosure, @Available, @ObjC, @NoEscape, @NonObjC, @NoReturn, @Testable, @WarnUnusedResult, @Convention, @NoReturn
>> 
>> or
>> 
>> @autoClosure, @available, @objC, @noEscape, @nonObjC, @noReturn, @testable, @warnUnusedResult, @convention, @noReturn
>> 
>> -- E
>> 
>> 
>>> On Feb 17, 2016, at 11:36 AM, Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>> wrote:
>>> 
>>> On Wed, 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
>>>> Status: TBD
>>>> Review manager: TBD
>>>> 
>>>> 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
>>>> 
>>>> 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.
>>> 
>>> Hi Erica,
>>> 
>>> Maybe it is just me, but I find @warnunusedresult to be unreadable --
>>> it looks like a continuous string of lowercase characters at a glance.
>>> 
>>> Dmitri
>>> 
>>> -- 
>>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>>*/
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> 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/d9b4cfcf/attachment.html>


More information about the swift-evolution mailing list