> On 5 Jul 2016, at 12:47, Charlie Monroe via swift-evolution 
> <[email protected]> wrote:
> 
> This is mentioned in Gabriel's proposal:
> 
>> Implement a native .cases static var for all enumerations without associated 
>> values
> 
> 
> But as has been mentioned in the discussion, this was mentioned by Brent:
> 
>> In previous discussions, the core team specifically asked that this be 
>> opt-in so that types which don't want it don't need to "pay" for it.
> 

Looking at the previous discussions, this kind of functionality belongs as part 
of reflection (once we have a mature reflection API). If you are reflecting a 
type that is completely known to the compiler (e.g. a concrete value-type, such 
as a struct or enum), it should be able to statically optimise it.

This is a commonly-enough requested feature that I would like to do it before 
the reflection API (there’s no public roadmap yet, but I don’t think it’s even 
under consideration for Swift 4). OTOH, I’m not sure if it makes sense to 
implement it in hacky way with compiler-generated constants and then replace it 
once we have a stable ABI.

Probably best to wait for the Swift 4 roadmap discussion and to see what the 
plans for reflection actually are. So I’m taking back my +1, sorry.

Karl
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to