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

Erica Sadun erica at ericasadun.com
Wed Feb 17 12:43:07 CST 2016


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> 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>>*/

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


More information about the swift-evolution mailing list