[swift-evolution] [Review] SE-0194: Derived Collection of Enum Cases

Kevin Nattinger swift at nattinger.net
Tue Jan 9 12:43:09 CST 2018


> Proposal link:
> 
> 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>
>  <https://github.com/apple/swift-evolution/pull/114#what-goes-into-a-review-1>
> What is your evaluation of the proposal?
+1 on the general problem, but I have a few comments on the design specifics

- I'd very much prefer automatic synthesis with enums, 
- I strongly feel the compiler should auto-generate the implementation in an extension for enums.
- Should we add `ValueCollection.Index == Int` to the associatedtype so it can always be indexed as in a table? 
  - At the least, we should ensure the synthesized implementation is int-indexed for tables.
- I feel we should allow auto-generation of imported c enums in an extension, as just an array of the known cases rather than the magical metadata iterator if necessary. 

> Is the problem being addressed significant enough to warrant a change to Swift?
Definitely. It's been a gaping hole in the language since the beginning.

> 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 prefer Java's automatic allValues(), but this is better than nothing.

> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Followed at least the start of several threads and read the proposal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180109/628bdda1/attachment.html>


More information about the swift-evolution mailing list