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

Trent Nadeau tanadeau at gmail.com
Wed Feb 17 12:47:52 CST 2016


I think both of the camel-case conventions are much easier to read, and
both are fine with me. I slightly prefer the former (UpperCamelCase), but
that just might be because the only languages I've used with annotations
that also have camel-case conventions (Java and C#) both use UpperCamelCase.

On Wed, Feb 17, 2016 at 1:43 PM, Erica Sadun via swift-evolution <
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> wrote:
>
> On Wed, Feb 17, 2016 at 10:18 AM, Erica Sadun via swift-evolution
> <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>*/
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>


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


More information about the swift-evolution mailing list