[swift-evolution] Pre-proposal: CaseEnumerable protocol (derived collection of enum cases)
Erica Sadun
erica at ericasadun.com
Tue Jan 19 19:05:29 CST 2016
> On Jan 19, 2016, at 1:54 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Jan 19, 2016, at 12:20 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
>>
>> Would you agree that it makes sense to:
>>
>> 1. Automatically derive CaseEnumerable (or ValueEnumerable or whatever we choose) for Swift enums without associated values;
>
> I think you'd want to opt in, by declaring 'enum Foo: CaseEnumerable {}', since providing this conformance makes some implicit promises not every type may want to publicly commit to.
+1
>
>> 2. Still allow "extension Foo: CaseEnumerable {}" to add it to enums imported from (Obj-)C headers?
>>
>> Or is it OK as-is, or is it worth pursuing some kind of "deriving" syntax?
>
> This is just my opinion, but I think declaring a conformance ought to be enough. You could imagine the compiler-synthesized implementation being provided by a protocol extension with sufficiently advanced language features from the future to implement the default behavior.
Also +1
:)
-- E, who believes in the sufficiently advanced language features from the future
>
> -Joe
> _______________________________________________
> 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