If I got the idea right, you would need to implement yourself the protocol 
methods to answer for both init(rawValue: Int) and init(rawValue: String) - 
which is how you have to do today only with the string part - while my proposed 
approach you'd have to implement nothing yourself.

L

> On 31 May 2016, at 7:19 pm, Austin Zheng via swift-evolution 
> <[email protected]> wrote:
> 
> If we had generic protocols, you could implement RawRepresentable twice, once 
> using Ints and one using Strings. But that's probably never going to happen.
> 
> /digression
> 
> Austin
> 
>> On Tue, May 31, 2016 at 3:11 PM, Erica Sadun via swift-evolution 
>> <[email protected]> wrote:
>> 
>> > On May 31, 2016, at 4:07 PM, Brent Royal-Gordon via swift-evolution 
>> > <[email protected]> wrote:
>> >
>> >> • also wants OptionSetType-like behavior (and thus an Int raw type).
>> >
>> > Then it's not an `enum`, it's a `struct`.
>> 
>> You can get it for free as an array of enums and test with contains vs member
>> 
>> -- E, who has probably digressed more than she really should
>> _______________________________________________
>> swift-evolution mailing list
>> [email protected]
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to