> https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md
>
> <https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md>
> What is your evaluation of the proposal?
Generally +1
I would like the behavior of the generated ValueEnumerable to be defined, even
if that behavior is based on the proposed implementation. Would this be
declaration order? Would it be out of declaration order if a raw integer value
was used and the cases did not have consistently increasing raw values?
I don’t know if there is an application compatibility suggestion here, such as
‘new enumerable values should be added to the end’.
I can also understand the value of not having the static property be an
Array<T> to save memory, but instead be Array-like. To this end, I think the
allValues property should have an additional constraint of an Index
associatedtype of Int. I don’t know if there is an additional requirement for
the indices being all the values from 0..<count for pedantry.
I think the type annotated with ValueEnumerable also needs to at a minimum be
Equatable to be generically useful.
I’d love to also suggest things like being Encodable, but if needed those can
be proposed later.
allValues isn’t the perfect bike shed shade IMHO because of a dissonance in my
own head, a carry-over from languages where enum values are singleton
instances. For someone who can keep enum behavior straight in their head, I
think the shade is perfectly fine.
> Is the problem being addressed significant enough to warrant a change to
> Swift?
I think so.
> Does this proposal fit well with the feel and direction of Swift?
Yes.
> If you have used other languages or libraries with a similar feature, how do
> you feel that this proposal compares to those?
I use Java’s version of this feature a fair bit. One common extension I see is
to convert textual names to enum values, something that it doesn’t support well
natively.
> How much effort did you put into your review? A glance, a quick reading, or
> an in-depth study?
A quick reading
-DW
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution