<div dir="ltr">I admire the desire of this proposal to increase the readability of code. I&#39;m -1 to the proposal itself, though:<div><br></div><div>- It breaks the ability to pass in a variable containing the desired value, rather than the literal value itself. (Unless you actually want a not-so-anonymous enum type whose definition happens to live in a function signature rather than somewhere you&#39;d usually expect a type definition to live.)</div><div>- It breaks the ability to store a reference to the function in a variable of function type (ditto).</div><div>- Almost every time I&#39;ve wanted to use one of these &quot;anonymous enums&quot; in my code, I&#39;ve ended up needing to use that same enum elsewhere. In my experience, &#39;lightweight enums&#39; don&#39;t end up saving much time compared to a full-fledged one.</div><div><br></div><div>Like Brent said, I have to say no to any proposal that tries to make enums synonyms for numerical values. What happens if you rearrange your anonymous enum cases between library versions? Do you somehow store an opaque case-to-UInt8 table somewhere for every anonymous enum you define for resilience? What happens when people start bringing back terrible C patterns, like doing arithmetic or bitwise ops on the underlying case values? At least you have to try pretty hard as it is to abuse Swift&#39;s enums.</div><div><br></div><div>Austin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 8:25 PM, Brent Royal-Gordon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">&gt; And the obvious answer is you can have up to 255 of these babies for the anonymous enum type, and be able to pass numerical equivalents UInt8 with compile time substitution. That the ad-hoc enumeration is basically a syntactic shorthand for UInt8, with an enforced upper bound compile time check simplifies everything including switch statements.<br>
<br>
</span>If I wanted a language like that, I&#39;d be writing C, not Swift.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>