<div dir="ltr">Would .cases return the enum’s cases in source-code order? That seems fragile at first glance.<div><br></div><div>It might be worth considering to have it return an unordered collection (set) instead.</div><div><br></div><div>Nevin</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 10:52 AM, Stephen Celis via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Does the naming &quot;values&quot; have precedence elsewhere? To me, &quot;cases&quot; is clearer, whereas &quot;rawValues&quot; would make sense if there was an additional, auto-generated static property for enumerations with underlying values.</div><div><br></div><div>    enum Section: Int { case SectionA, Section B }</div><div>    Section.cases // [.SectionA, .SectionB]</div><div>    Section.rawValues // [0, 1]</div><div><br></div><div>Because &quot;rawValue&quot; already exists, &quot;values&quot; makes things a bit more confusing: are they the cases themselves or are they their underlying values?</div><div><br></div><div>Stephen</div><br><div><blockquote type="cite"><div><div class="h5"><div>On Dec 21, 2015, at 3:57 AM, Charles Constant via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">If you change your proposal to focus on &quot;.values&quot; instead of &quot;.values.count&quot; (which you&#39;d get for free, as you note) I would strongly support it. I don&#39;t need &quot;.count&quot; on its own, but &quot;.values&quot; ... well, I have a whole load of enums in my current projects with a &quot;.values&quot; I had to hardcode myself. I would love to get that for free.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 12:46 AM, Brent Royal-Gordon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>&gt; I’ve put a proposal up on GitHub to add a cases ‘count’ functionality to Enums for the Swift language<br>
&gt; <a href="https://gist.github.com/andyyhope/2fc5b6bee8ee1346f688" rel="noreferrer" target="_blank">https://gist.github.com/andyyhope/2fc5b6bee8ee1346f688</a><br>
<br>
</span>I think we&#39;d be much better off having a list of all cases. That would make this feature useful for enums which don&#39;t have a raw type, or don&#39;t use Int as their raw type, or don&#39;t use sequential raw values for their cases.<br>
<br>
That approach has been discussed before, but not formally proposed.<br>
<span><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</font></span></blockquote></div><br></div>
</div></div><img alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
_______________________________________________<span class=""><br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br>
<img alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>