<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 25, 2016 at 8:15 PM, David Sweeris 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div>On May 25, 2016, at 7:37 AM, Leonardo Pessoa via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div></span><div><span class=""><div><blockquote type="cite"><br><div><div><div><div style="font-family:Calibri,sans-serif;font-size:11pt">Hi,<br><br>Couldn&#39;t this be solved by using tuples? If not because the syntax is not allowed I think this would be more coherent to do it using current syntax.<br><br>enum Planet : (mass: Float, radius: Float) {<br>    case mercury = (mass: 3.303e+23, radius: 2.4397e6)<br>    case venus = (mass: 4.869e+24, radius: 6.0518e6)<br>    case earth = (mass: 5.976e+24, radius: 6.37814e6)<br>    case mars = (mass: 6.421e+23, radius: 3.3972e6)<br>    case jupiter = (mass: 1.9e+27, radius: 7.1492e7)<br>    case saturn = (mass: 5.688e+26, radius: 6.0268e7)<br>    case uranus = (mass: 8.686e+25, radius: 2.5559e7)<br>    case neptune = (mass: 1.024e+26, radius: 2.4746e7)<br>}</div></div></div></div></blockquote></div><div><br></div></span>This would be my preferred solution… AFAIK, the only reason we can’t do it now is that Swift currently requires RawValue be an integer, floating-point value, or string. I don’t know why the language has this restriction, so I can’t comment on how hard it would be to change.<div><br></div></div><div>- Dave Sweeris</div></div></blockquote><div><br></div>Except you&#39;d have to write Planet.mercury.rawValue.mass, rather than Planet.mercury.mass.<div><br></div><div>This could be one or two proposals: allow enums with tuple RawValues, and allow `TupleName.caseName.propertyName` to access a tuple element without going through .rawValue.</div><div><br></div></div></div></div>