<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><blockquote type="cite" class=""><div class="">On Apr 22, 2016, at 11:48 PM, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 11:34 PM, John McCall <span dir="ltr" class=""><<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Apr 22, 2016, at 11:11 PM, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com" target="_blank" class="">jtbandes@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 10:50 PM, John McCall <span dir="ltr" class=""><<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div class=""><br class=""></div></div></div></div>I have not been following this discussion, but I would be extremely antsy about guaranteeing any particular representation for the set of values. Guaranteeing a contiguous array implementation seems like a really bad idea, especially if that's taken to mean that we're going to actually provide a static global array. But there's no way to avoid providing a public API, because a public conformance itself implies a public API with some level of corresponding overhead.</div></blockquote><div class=""><br class=""></div><div class="">A "compiler magic" version of the feature, like #allValues(MyEnum), could generate a static array *internal* to the caller's module, but I'm sure there are implications or details of this which I'm not aware of.</div></div></div></div></div></blockquote><div class=""><br class=""></div></span>That cannot be reconciled with resilience. The caller cannot reliably know the set of stored cases; only the defining module can.</div><div class=""><br class=""></div><div class="">For similar reasons, only the defining module can be allowed to magically derive a conformance to your protocol, if indeed it's done with a protocol.</div></div></blockquote><div class=""><br class=""></div><div class="">What should/can this mean for enums imported from Obj-C, via other modules, or bridging headers / custom module maps? In these cases, the defining module has no Swift code. Is there a way to do it with pre-existing metadata in the module?</div></div></div></div>
</div></blockquote></div><br class=""><div class="">Imported declarations are always something of a special case for this sort of thing.</div><div class=""><br class=""></div><div class="">It is possible to import an enum as "open", meaning that the library reserves the right to add new enumerators; it would never be possible to make such a type ValuesEnumerable, at least via the built-in magic. But otherwise we could certainly give imported enums this conformance by default if we wanted to.</div><div class=""><br class=""></div><div class="">John.</div></body></html>