<p dir="ltr">Enumerations are a good example. <br>
Or JSON nodes. </p>
<p dir="ltr"><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002474.html">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002474.html</a></p>
<div class="gmail_quote">On Dec 16, 2015 16:05, "Matthew Johnson" <<a href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br></div><blockquote type="cite"><div><div dir="ltr"><div>// require value to be of type Bool OR Double OR String OR SomeProtocol</div><div><font face="monospace, monospace">let value: (Bool | Double | String | SomeProtocol)</font></div><div><font face="monospace, monospace">switch value {</font></div><font face="monospace, monospace"> case let _ as Bool: …</font><div><font face="monospace, monospace"> case let _ as Double: …<br> case let _ as String: …<br> case let _ as SomeProtocol: …</font></div><div><font face="monospace, monospace"> // no default necessary<br></font><div><font face="monospace, monospace">}</font></div></div></div></div></blockquote><br><div>This is a structural union type which has received considerable discussion with commentary from core team members already in the with a subject something like "STL and Either". You may be interested in reading that discussion. The summary is that we are unlikely to see it without extremely compelling use cases.</div></div></blockquote></div>