<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="">Also, just to be clear, (unfortunately) the enum ship has sailed and I don’t think we’ll get a rename/split to union, it’s just that the functionality of associated objects is conceptually closer to what other languages call a union. &nbsp;I would, however, like the ability to use an enum in the proper way, as a set of compile-time-constant data accessed in an easier way than having to use the ugly but currently necessary hack of `switch value { case .x: return 1; case .y: return 2; … }`.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 10, 2016, at 11:52 AM, Kevin Nattinger &lt;<a href="mailto:swift@nattinger.net" class="">swift@nattinger.net</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 10, 2016, at 11:30 AM, Robert Widmann &lt;<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">By imposing that kind of separation you leave an entire class of generic and structural programming patterns off the table. &nbsp;An enumeration is not just an enumeration of constants, it is an enumeration of <i class="">data, </i>and data takes far more useful forms than just bitfields</div></div></div></blockquote><div class=""><br class=""></div><div class="">I’m not sure where you got “bitfields” from, perhaps I was unclear. I think enums should be a set of cases, each case having its distinct and constant set of data with the same structure. If one entity needs data of different, dynamic structure and value at runtime, that is essentially the definition of a union.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""> - similarly when it does have that form it fits precisely into the form of an enum with no cases? &nbsp;Why artificially separate the two concepts when they’re clearly one and the same?</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 10, 2016, at 2:24 PM, Kevin Nattinger via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I agree wholeheartedly. An enum case should be a compile-time constant. &nbsp;IMO, “enums” with associated values should properly be a separate entity, called “union” as that’s essentially what they are. <br class=""><br class=""><blockquote type="cite" class="">On Oct 10, 2016, at 10:31 AM, Kenny Leung via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">This is the way Java enumerations work. <br class=""><br class=""><a href="https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html" class="">https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html</a><br class=""><br class="">I think it is a good model, and I think Swift enumerations should also work the same way.<br class=""><br class="">An enumeration is a finite set of things. It’s really inconvenient to have to limit those things to have only a single attribute.<br class=""><br class="">-Kenny<br class=""><br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></body></html>