[swift-evolution] Proposal: Enum 'count' functionality
Joe Groff
jgroff at apple.com
Mon Dec 21 16:56:39 CST 2015
> 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