<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-01-17 22:26 GMT+03:00 Joe Groff <span dir="ltr">&lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt;</span>:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div><div dir="ltr"><div class="m_2713933647074215098markdown-here-wrapper"><p style="margin:0px 0px 1.2em!important"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">enum Something : RawRepresentable&lt;Int32&gt;</code><br>+1. But we don’t have generic protocols right now :(</p></div></div></div></blockquote></span><div>I think this would be the right direction to go if we wanted to de-magic the existing RawRepresentable behavior. At this point, It would be reasonable to support this via where clauses on associated types:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>enum Something: RawRepresentable where RawValue == Int32 { ... }</div></div></blockquote></div></blockquote><div><br></div><div>We don&#39;t have this conformance syntax either. As the enum is not generic, the above should be read as:<br></div><div><br></div><div>    enum Something: (RawRepresentable where RawValue == Int32) { ... }</div><div><br></div><div>And this requires generalized existentials again.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>though that&#39;s pretty verbose. In the fullness of time, a generic typealias to a generalized existential could help with that, though:<br></div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>typealias RawRepresentableOf&lt;T&gt; = RawRepresentable where RawValue == T</div></div></blockquote><div><br></div><div>At that point, the compiler-built becomes closer to just a &quot;regular&quot; default implementation. There&#39;s still the privileged sugar for matching cases to raw values.</div><span class="HOEnZb"><font color="#888888"><br><div>-Joe</div><div><br></div></font></span></div></blockquote></div><br></div></div>