[swift-evolution] Pre-proposal: CaseEnumerable protocol (derived collection of enum cases)

Denis Nikitenko d.nikitenko at icloud.com
Wed Jan 20 10:45:15 CST 2016


For the protocol name, I rather like FiniteType (or FiniteValueType), since I find it to be more general and future-proof.  ValueEnumerable would also work, though.  

My preference for the static var would be T.values or T.allValues - we want to get all values of the finite type T.

Definitely a +1 on the overall proposal.



>> On Jan 18, 2016, at 11:15 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>> OK, I can see the argument here. I was worried about making this proposal so broad that it wouldn't be seriously considered, but I agree that choosing more general names will open it up to future expansion.
>> 
>> Here are some more name ideas:
>> 
>> - CaseEnumerable (in the proposal draft)
>> - T.cases (in the proposal draft)
>> - T.allCases
>> - FiniteType (as you suggested)
>> - FiniteValueType
>> - ValueEnumerable
>> - T.values
>> - T.allValues
>> 
>> Thoughts? More suggestions? I think I like ValueEnumerable.
>> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list