[swift-evolution] List of all Enum values (for simple enums)

Chris Lattner clattner at apple.com
Wed Dec 9 19:47:27 CST 2015

On Dec 9, 2015, at 5:30 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
>> 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.
> I’m not sure what you mean here,
> -Chris
> I'd have to look at the code before I'll be able to ask a fully coherent question (you mentioned the same place memberwise initializers are synthesized).
> I was guessing that having multiple "extension NSSortOptions : Enumerable {}" in different modules (or different files in the same module) might cause problems, so you'd have to do it only one place — i.e. NSSortOptions would either be imported as protocol<OptionSetType, Enumerable> or it wouldn't, with no way to change it post-hoc from user code.

Ah, I see what you mean.  Yes, I don’t think that the memberwise initializer logic is the place to look, it is probably better to look at at the logic that synthesizes the ErrorType members, since this is currently allowed:

	enum X { case A, B }
	extension X : ErrorType {}

in principle there should be no problem with multiply defined members, since they will have different module qualifications and name lookup paths.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151209/21c9984c/attachment.html>

More information about the swift-evolution mailing list