[swift-evolution] Proposal: Enum 'count' functionality

Erica Sadun erica at ericasadun.com
Mon Dec 21 16:58:55 CST 2015


That would be okay too. Thank you, Santa Joe.

-- E, who hopes she was on the nice list.

> On Dec 21, 2015, at 3:56 PM, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Dec 21, 2015, at 12:24 PM, Erica Sadun <erica at ericasadun.com> wrote:
>> 
>> I could be satisfied by such an approach.  I could even be more satisfied if
>> 
>>> enum Foo: ValueEnumerable { case A, B, C }
>> 
>> 
>> were also essentially an alias for
>> 
>>> enum Foo: Int, ValueEnumerable { case A=0, B, C }
>> 
>> :)
> 
> If the value collection were sufficiently capable, you wouldn't necessarily need an implicit Int raw value; you could do `allValues.indexOf(.A)` to get the index for a case.
> 
> -Joe
> 



More information about the swift-evolution mailing list