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

Kevin Lundberg kevin at klundberg.com
Sat Jan 23 12:45:10 CST 2016


> On Jan 23, 2016, at 1:24 PM, Trent Nadeau via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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).

This reasoning makes sense to me. It's also a convention that I've seen on other languages like Java and C# where enum cases are capitalized even though they aren't strictly types of their own.

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

I think of option set elements in the same way as enums here, where each option set option can behave as an individual singleton type that represents a specific value. The way they're used reminds me a lot of how enums are typically used, just with multiple instances at once in a set instead of a single enum case.


More information about the swift-evolution mailing list