<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I could be satisfied by such an approach. I could even be more satisfied if</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">enum Foo: ValueEnumerable { case A, B, C }</div></div></blockquote></div><div class=""><br class=""></div><div class="">were also essentially an alias for</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">enum Foo: Int, ValueEnumerable { case A=0, B, C }</div></div></blockquote><br class=""></div><div class="">:)</div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Dec 21, 2015, at 1:14 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 21, 2015, at 12:09 PM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">My wild aspirations in a nutshell:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Core enums: Any enum that's created without raw or associated values, e.g. enum MyEnum {case This, That, Whatever, Etc}, can (and should) be Array<Self> representable. This would add intrinsic ordering and raw value construction starting with 0, up to count - 1. End-devs could use the ordering or not use the ordering, but it would be possible to convert to bit representation (1 << this.rawValue), support iteration through the enumeration, introduce ranges for switches, etc. A massive improvement.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Raw value enums: Any enum that uses raw values, e.g. enum ForExample: String {case Hello = "hello", There = "there"} should be representable as Set<T></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Associated type enums: all bets are off</div></div></blockquote><br class=""></div><div class="">There's only one kind of enum fundamentally, and I think we should make for more continuity between different instances of enum rather than less. Any type with a reasonably finite number of states ought to be able to support a `values` collection. If it happens to have a RawRepresentable conformance, mapping from values to rawValues is easy, and could be provided by a protocol extension on ValueEnumerable where Self: RawRepresentable. Enums with associated values that are themselves ValueEnumerable could enumerate all the values of the associated value, so something like this:</div><div class=""><br class=""></div><div class="">enum Foo: ValueEnumerable { case A, B, C }</div><div class=""><br class=""></div><div class="">enum Bar: ValueEnumerable { case X(Foo), Y(Foo) }</div><div class=""><br class=""></div><div class="">would give you `.X(.A)`, `.X(.B)`, `.X(.C)`, etc. (You could also derive ValueEnumerable for structs by walking the cartesian product of the stored properties' values, but I don't know if that's really useful.)</div><div class=""><br class=""></div><div class="">-Joe</div></div></div></blockquote></div><br class=""></div></body></html>