<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><style type="text/css">body { background: rgba(255, 255, 255, 255); }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">Am 06.12.2015 um 01:28 schrieb Alex Lew via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I don't think you can just get rid of the if statement in favor of an expression. You still want to be able to do this:<div class=""><br class=""></div><div class="">if (condition) {</div><div class=""> funcWithSideEffectsThatReturnsInt()</div><div class="">} else {</div><div class=""> funcWithSideEffectsThatReturnsString()</div><div class="">}</div><div class=""><br class=""></div><div class="">but that's not a valid expression (what is its type?).</div></div></div></blockquote><div><br class=""></div><div>That would actually be no problem if Swift’s type system would have union types (Ceylon has union and intersection types which are quite awesome and enable lots of nice things quite naturally, see <a href="http://ceylon-lang.org/documentation/1.2/tour/types/" class="">http://ceylon-lang.org/documentation/1.2/tour/types/</a>).</div><div><br class=""></div><div>In that case the type of such an expression would just be the union of both types, which is written <font face="Courier" class="">Int | String</font> in Ceylon.</div><div><br class=""></div><div>-Thorsten</div></div><br class=""></body></html>