<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 12 Oct 2016, at 09:41,Mateusz Malczak wrote:</div></blockquote><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">That's exactly what this proposal is about. I would like to</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">keep all enum properties but add an extra feature, so that enums can</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">store some extra data.</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><br class=""></div><div>If technically possible I would prefer to directly use types for enum cases.</div><div>Reducing a type to a tuple loses the computed properties and methods of the type.</div><div>The types must be equatable I suppose.</div><div><br class=""></div><div>The current enum rawValues are just indexes or keys which the compiler can autogenerate (like it does for enums without a raw type). </div><div>Of course the raw values can be used in some smart way, like for sorting or grouping cases, but this can all be done with general types - and better at that.</div><div><br class=""></div><div>So basically you have a struct type and an enum which is just a set of static lets of the struct type.</div><div>struct MyStruct {}</div><div>enum MyEnum: MyStruct</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>case myStruct1</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>case myStruct2</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br class=""></div><div>MyStruct need not be created specifically for the enum; it might be useful on its own.</div><div>MyEnum can have additional computed properties and methods which are needed for the enumerated values only.</div><div><br class=""></div><div>The cases can be accessed like MyStruct instances. No need for .rawValue except in the case of primitive types. Even there there is room for sugar (if a variable is already known to be of type Int we can assign an enum:Int case to it with implied .rawValue).</div><div><br class=""></div><div>Jan E.</div><br class=""><div class=""><br class=""></div></body></html>