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

Brent Royal-Gordon brent at architechies.com
Fri Dec 11 18:43:54 CST 2015


> However, I do have a suggestion that’s different from what Brent suggested, which is that instead of returning actual enum values, I could see returning the functions associated with them as being potentially useful. I can show an example of what this might look like if anyone is interested.

Interesting. The problem I see with this is that, if by “the functions associated with them” you mean their constructors, each constructor would have a different set of parameters. To distinguish between them, you would probably need…an enum.

On the other hand, if you mean “functions testing an instance of the enum against that case, and returning true if it matches”, that’s a more interesting possibility.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list