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

Vladimir.S svabox at gmail.com
Tue Jan 9 15:12:08 CST 2018


On 09.01.2018 21:43, Kevin Nattinger via swift-evolution wrote:
>>     Proposal link:
>>
>>         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.
> 

FWIW +1 for all Kevin said

>>   * 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.
> 
> 
> _______________________________________________
> 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