<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 9, 2015, at 5:24 PM, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 9, 2015 at 5:05 PM, Chris Lattner <span dir="ltr" class=""><<a href="mailto:clattner@apple.com" target="_blank" class="">clattner@apple.com</a>></span> wrote:<br class=""><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" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Dec 9, 2015, at 10:19 AM, David Waite <<a href="mailto:david@alkaline-solutions.com" target="_blank" class="">david@alkaline-solutions.com</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class="">There are a number of possible proposals for enhancements I see off the bat for “basic" enums (without associated data):</div><div class=""><br class=""></div><div class="">1. A generated implementation of SequenceType based on declaration order</div><div class="">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 class="">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 class=""><br class=""></div></span><div class="">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 class=""><br class=""></div><div class="">enum X { A, B } // not enumerable.</div><div class="">enum X : Enumerable { A, B } // has allValues and other stuff automatically generated.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-Chris</div></font></span></div></div></blockquote><div class=""><br class=""></div><div class="">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 {}”. </div></div></div></div></div></blockquote><div><br class=""></div><div>Yes, exactly. This would allow it to work with C types as you suggest, as well as providing the ability to retroactively provide it for Swift enums that didn’t anticipate the need.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">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></div></div></div></blockquote></div><br class=""><div class="">I’m not sure what you mean here,</div><div class=""><br class=""></div><div class="">-Chris</div></body></html>