[swift-evolution] [Review] SE-0023 API Design Guidelines

Trent Nadeau tanadeau at gmail.com
Sat Jan 23 12:24:37 CST 2016


I think it makes sense for enum cases to be UpperCamelCase as they can be
thought of as scoped types (singleton types in the case of cases with no
associated types).

Option set elements, on the other hand, I think really are values so it may
make sense for those to be lowerCamelCase.

On Sat, Jan 23, 2016 at 1:11 PM, Joe Groff via swift-evolution <
swift-evolution at swift.org> wrote:

>
> On Jan 23, 2016, at 2:12 AM, Marc Knaup via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> What is the rationale behind naming enumeration cases in upper camel case?
>
> *Follow case conventions:* names of types, protocols and enum cases are
>> UpperCamelCase. Everything else is lowerCamelCase.
>
>
> let a = NSComparisonResult.OrderedSame  // refers to a value, but is
> upper-case
> let b = NSDate.distantFuture            // refers to a property/value, but
> is lower-case
>
>    - everything related to types (type names, protocol names, generic
>    type parameter names) should be upper camel case
>    - everything else (function names, property names, variable names,
>    etc.) should be lower camel case
>
> This is already the current and the proposed recommendation with
> enumeration cases being the only exception.
> Enumeration cases are not types.
>
>
> I agree. It would make enum cases feel more consistent with the rest of
> the language to make them lowerCamelCase.
>
> -Joe
>
>
> _______________________________________________
> 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/20160123/981c7b27/attachment.html>


More information about the swift-evolution mailing list