<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=""><div class="">Huh, see, that's why I posted the thread; I didn't know you could do it that way (I've been trying the RawRepresentable part as its own type).</div><div class="">In that case yes, it seems like all that's need is an expansion of what's allowable on the rhs of raw value enum cases.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 14 Oct 2016, at 18:11, Karl Wagner &lt;<a href="mailto:razielim@gmail.com" class="">razielim@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 dir="auto" class=""><div class=""><div style="direction: inherit;" class="">Example:</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class=""><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">enum something {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; case onething</div><div style="direction: inherit;" class="">&nbsp; &nbsp; case anotherthing</div><div style="direction: inherit;" class="">}</div><div style="direction: inherit;" class="">extension something : RawRepresentable {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; typealias RawValue = (Int, Int)</div><div style="direction: inherit;" class="">&nbsp; &nbsp;&nbsp;</div><div style="direction: inherit;" class="">&nbsp; &nbsp; init?(rawValue: something.RawValue) {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; switch rawValue {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; case (1, 1):</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self = .onething&nbsp;</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; case (2, _):</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self = .anotherthing</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; default:</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &nbsp;nil&nbsp;</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="direction: inherit;" class="">&nbsp; &nbsp; }</div><div style="direction: inherit;" class="">&nbsp; &nbsp;&nbsp;</div><div style="direction: inherit;" class="">&nbsp; &nbsp; var rawValue: (Int, Int) {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; switch self {</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; case .onething: return (1, 1)</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; case .anotherthing: return (2, 0)</div><div style="direction: inherit;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="direction: inherit;" class="">&nbsp; &nbsp; }</div><div style="direction: inherit;" class="">}</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">let whatisit = something(rawValue: (1, 1))</div><div style="direction: inherit;" class="">something.onething.rawValue</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">Karl</div></div><br class="">Sent from my iPad</div><div class=""><br class="">On 14 Oct 2016, at 19:04, Karl Wagner &lt;<a href="mailto:razielim@gmail.com" class="">razielim@gmail.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div class=""><div style="direction: inherit;" class="">You can already do this; you just need to implement RawRep manually.</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">What I think you mean to propose is that the compiler shorthand we have (which synthesises the conformance if you use the equal signs next to the cases) be extended to support tuples of the types it currently supports. That's a relatively simple, non-source-breaking additive change. It likely doesn't fit in the scope of swift 4 phase 1, though (sorry, I've been guilty of chatting about non-abi stuff too as I encounter things which irritate me; trying to be more disciplined)</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">Karl</div><div style="direction: inherit;" class=""><br class=""></div>Sent from my iPad</div><div class=""><br class="">On 14 Oct 2016, at 12:55, Haravikk via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class=""></span><br class=""><blockquote type="cite" class=""><span class="">On 14 Oct 2016, at 09:49, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>&gt; wrote:</span><br class=""></blockquote><blockquote type="cite" class=""><span class=""></span><br class=""></blockquote><blockquote type="cite" class=""><span class="">I'm very much in favor of the functionality, but I don't think the implementation should rely on compiler magic.</span><br class=""></blockquote><blockquote type="cite" class=""><span class=""></span><br class=""></blockquote><blockquote type="cite" class=""><span class="">- Dave Sweeris </span><br class=""></blockquote><span class=""></span><br class=""><span class="">Well it's not too much in the way of magic really, more just that we need Swift to see tuples as conforming to RawRepresentable and ExpressableAsTuple, although they currently aren't types in the normal sense. So the protocols being used will be the same as you might use yourself, they'll just be applied automatically for tuples.</span><br class=""><span class=""></span><br class=""><span class="">It'd be neat if it could be done properly, but that could involve even more work, but doing this automatically for now should be fairly simple (though I say that as a person who wouldn't be the one doing it ;)</span><br class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></blockquote></div></div></blockquote></div><br class=""></body></html>