<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 9, 2015 at 5:05 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Dec 9, 2015, at 10:19 AM, David Waite <<a href="mailto:david@alkaline-solutions.com" target="_blank">david@alkaline-solutions.com</a>> wrote:</div><br><div><div style="word-wrap:break-word"><div><div>There are a number of possible proposals for enhancements I see off the bat for “basic" enums (without associated data):</div><div><br></div><div>1. A generated implementation of SequenceType based on declaration order</div><div>2. A second interface or extension to the enum type could supply static max and min properties when the RawValue is Comparable</div></div><div>3. For enums with a String raw value, CustomStringConvertible and Streamable might make sense as well. You would likely want CustomDebugStringConvertible to also be defined to supply the original type-based value.</div></div></div></blockquote><div><br></div></span><div>Another design point to consider: instead of making *every* enum generate the “allValues” capability, it might make sense to restrict this synthesization to enums that opt into it by conforming to a protocol. Intentionally not the right protocol name, but perhaps:</div><div><br></div><div>enum X { A, B } // not enumerable.</div><div>enum X : Enumerable { A, B } // has allValues and other stuff automatically generated.</div><span><font color="#888888"><div><br></div><div>-Chris</div></font></span></div></div></blockquote><div><br></div><div>And I suppose it would have to be possible to add this conformance to a pre-existing type? You'd want to be able to do "extension NSTextAlignment : Enumerable {}". But I'm not sure if it would work well to generate this on-demand; might work better to do it at interface-generation time, along with OptionSetType conformances, etc.</div><div><br>Jacob</div>
</div></div></div>