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

Chris Lattner clattner at apple.com
Mon Jan 25 00:14:48 CST 2016


> On Jan 23, 2016, at 10:36 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> On Jan 23, 2016, at 2:12 AM, Marc Knaup <marc at knaup.koeln <mailto:marc at knaup.koeln>> wrote:
>> 
>> What is the rationale behind naming enumeration cases in upper camel case?
>> 
>> Follow case conventions: names of types, protocols and enum cases areUpperCamelCase. 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.
> 
> This is something that’s come up a few times before, and I (personally) agree that it makes more sense for enum cases to be lowerCamelCase. Thanks for bringing it up!

I agree as well.  Enum cases are values (not types) by every measure I know of.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160124/4da43377/attachment.html>


More information about the swift-evolution mailing list