<div dir="ltr">To clarify, I would want parens around the entire expression (only when necessary). So<div><br></div><div><div style="font-size:13px">let myColor = match yourColor</div><span class="im" style="font-size:13px"><div><span style="white-space:pre-wrap"> </span>case .Blue :  .Red</div><div><span style="white-space:pre-wrap"> </span>case .Green: .Blue </div><div><span style="white-space:pre-wrap"> </span>case .Red: .Green</div><div><span style="white-space:pre-wrap"> </span>default: .Yellow</div><div><br></div><div><span style="color:rgb(34,34,34)">or</span><br></div><div><span style="color:rgb(34,34,34)"><br></span></div><div><div style="color:rgb(34,34,34)">let myColor = match boolCondition</div><div style="color:rgb(34,34,34)">  case true: .Blue</div><div style="color:rgb(34,34,34)">  case false: .Red</div><div style="color:rgb(34,34,34)"><br></div><div style="color:rgb(34,34,34)">or</div><div style="color:rgb(34,34,34)"><br></div><div style="color:rgb(34,34,34)"><div>let myColor = match boolCondition</div><div>  case true: (match yourColor</div><div>                      case .Red: .Blue</div><div>                      default: .Yellow)</div><div>  case false: .Red</div><div><br></div><div>But I actually think that the parens are unnecessary, as long as we require matches to be exhaustive and for there to be no unreachable cases.</div></div><div class="" style="color:rgb(34,34,34)"></div></div></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 4:17 PM, Paul Ossenbruggen <span dir="ltr">&lt;<a href="mailto:possen@gmail.com" target="_blank">possen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
 I agree that ? may imply optional, this may be similar to what you suggested, just filling in the example: Not sure parenthesis are better than braces though:
</div>
<div>
 <br>
</div>
<div>
 <div>
  <div>
   et myColor = match yourColor ( .Blue :  .Red, .Green: .Blue, .Red: .Green, default: .Yellow )
  </div>
  <div>
   <br>
  </div>
  <div>
   <div style="word-wrap:break-word">
    <div>
     <div>
      <div>
       <div>
        <div>
         <div>
          <div>
           <div>
            <div dir="ltr"></div>
           </div>
          </div>
         </div>
        </div>
       </div>
      </div>
     </div>
    </div>
   </div>
  </div>
  <div></div>
 </div>
 <div>
  <div>
   let myColor = match yourColor ( case .Blue : .Red; case .Green: .Blue;  case .Red: .Green; default: .Yellow )
  </div>
  <div>
   <br>
  </div>
  <div>
   <div style="word-wrap:break-word">
    <div>
     <div>
      <div>
       <div>
        <div>
         <div>
          <div>
           <div>
            <div dir="ltr"></div>
           </div>
          </div>
         </div>
        </div>
       </div>
      </div>
     </div>
    </div>
   </div>
  </div>
  <div></div>
 </div>
 <div>
  <div>
   let myColor = match yourColor (
  </div><span class="">
  <div>
   <span style="white-space:pre-wrap"> </span>case .Blue :  .Reds
  </div>
  <div>
   <span style="white-space:pre-wrap"> </span>case .Green: .Blue 
  </div>
  <div>
   <span style="white-space:pre-wrap"> </span>case .Red: .Green
  </div>
  <div>
   <span style="white-space:pre-wrap"> </span>default: .Yellow
  </div>
  </span><div>
   )
  </div>
  <div>
   <br>
  </div>
  <div>
   <div>
    <div>
     let myColor = match yourColor (
    </div><span class="">
    <div>
     <span style="white-space:pre-wrap"> </span>.Blue :  .Reds
    </div>
    <div>
     <span style="white-space:pre-wrap"> </span>.Green: .Blue 
    </div>
    <div>
     <span style="white-space:pre-wrap"> </span>.Red: .Green
    </div>
    <div>
     <span style="white-space:pre-wrap"> </span>default: .Yellow
    </div>
    </span><div>
     )
    </div>
    <div>
     <br>
    </div>
   </div>
  </div>
  <div>
   let myColor = match boollCondition ( .Blue, .Red ) 
  </div>
  <div>
   <br>
  </div>
  <div>
   <br>
  </div>
 </div>
</div><div class="HOEnZb"><div class="h5">
<div>
 <br>
 <div>
  <blockquote type="cite">
   <div>
    On Dec 6, 2015, at 12:54 PM, Alex Lew &lt;
    <a href="mailto:alexl.mail+swift@gmail.com" target="_blank">alexl.mail+swift@gmail.com</a>&gt; wrote:
   </div>
   <br>
   <div>
    <div dir="ltr">
     Hmm. Something about braces inside expressions just feels wrong to me.
     <div>
      <br>
     </div>
     <div>
      I also read switch? and if? as being some optional-related versions of switch and if. And I don&#39;t love putting the condition / value-to-switch-on 
      <i>before </i>the keyword, if we&#39;re going to use a keyword.
     </div>
     <div>
      <br>
     </div>
     <div>
      (Also: exhaustiveness checking 
      <i>could </i>theoretically allow resolution of ambiguity in nested switch expressions. We would just have to require that as soon as you&#39;ve exhausted all possibilities, you don&#39;t add more cases and the expression is over.)
     </div>
    </div>
    <div class="gmail_extra">
     <br>
     <div class="gmail_quote">
      On Sun, Dec 6, 2015 at 3:46 PM, Paul Ossenbruggen 
      <span dir="ltr">&lt;<a href="mailto:possen@gmail.com" target="_blank">possen@gmail.com</a>&gt;</span> wrote:
      <br>
      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       <div style="word-wrap:break-word">
        Yep probably does need braces: So for switch? if? suggestion i just made. 
        <div>
         <br>
        </div>
        <div>
         <div>
          let myColor = yourColor switch? { .Blue :  .Red, .Green: .Blue, .Red: .Green, default: .Yellow }
         </div>
         <div>
          <br>
         </div>
         <div>
          <div style="word-wrap:break-word">
           <div>
            <div>
             <div>
              <div>
               <div>
                <div>
                 <div>
                  <div>
                   <div dir="ltr"></div>
                  </div>
                 </div>
                </div>
               </div>
              </div>
             </div>
            </div>
           </div>
          </div>
         </div>
         <div></div>
        </div>
        <div>
         <div>
          let myColor = yourColor switch? { case .Blue : .Red; case .Green: .Blue;  case .Red: .Green; default: .Yellow }
         </div>
         <div>
          <br>
         </div>
         <div>
          <div style="word-wrap:break-word">
           <div>
            <div>
             <div>
              <div>
               <div>
                <div>
                 <div>
                  <div>
                   <div dir="ltr"></div>
                  </div>
                 </div>
                </div>
               </div>
              </div>
             </div>
            </div>
           </div>
          </div>
         </div>
         <div></div>
        </div>
        <div>
         <span>
          <div>
           let myColor = yourColor switch? {
          </div>
          <div>
           <span style="white-space:pre-wrap"> </span>case .Blue :  .Reds
          </div></span>
         <span>
          <div>
           <span style="white-space:pre-wrap"> </span>case .Green: .Blue 
          </div>
          <div>
           <span style="white-space:pre-wrap"> </span>case .Red: .Green
          </div>
          <div>
           <span style="white-space:pre-wrap"> </span>default: .Yellow
          </div>
          <div>
           }
          </div>
          <div>
           <br>
          </div></span>
         <span>
          <div>
           <div>
            <div>
             let myColor = yourColor switch? {
            </div>
            <div>
             <span style="white-space:pre-wrap"> </span>.Blue :  .Reds
            </div>
            <div>
             <span style="white-space:pre-wrap"> </span>.Green: .Blue 
            </div>
            <div>
             <span style="white-space:pre-wrap"> </span>.Red: .Green
            </div>
            <div>
             <span style="white-space:pre-wrap"> </span>default: .Yellow
            </div>
            <div>
             }
            </div>
           </div>
          </div>
          <div>
           <br>
          </div></span>
         <span>
          <div>
           let myColor = condition if?  { .Blue; .Red }
          </div>
          <div>
           <br>
          </div></span>
         <div>
          I don’t find that looks bad. 
         </div>
         <div>
          <br>
         </div>
         <div>
          - Paul 
         </div>
         <div>
          <br>
         </div>
         <div>
          <br>
          <div>
           <blockquote type="cite">
            <div>
             <div>
              <div>
               On Dec 6, 2015, at 12:24 PM, Alex Lew via swift-evolution &lt;
               <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:
              </div>
              <br>
             </div>
            </div>
            <div>
             <div>
              <div>
               <div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                Thanks for the feedback, Matthew. It&#39;s sensible to me to consider dropping the ternary operator. I like it because the analogy &quot;C&#39;s if is to Swift&#39;s if as C&#39;s ternary operator is to Swift&#39;s ternary operator&quot; is (sort of) satisfied. But it is also confusing, both for the reasons you mention, and because ? has other meanings in Swift:
                <div>
                 <br>
                </div>
                <div>
                  // compiler error without space betw thatColor and ?
                 <br>
                </div>
                <div>
                 let thisColor = thatColor? 
                </div>
                <div>
                      case .Red: .Green
                </div>
                <div>
                      default: .Blue
                </div>
                <div>
                 <br>
                </div>
                <div>
                 On the other hand, is it really worth it to have control flow expressions if they don&#39;t let your code look nicer?
                </div>
                <div>
                 <br>
                </div>
                <div>
                 let thisColor = switch thatColor {
                </div>
                <div>
                      case .Red:
                </div>
                <div>
                           return .Green;
                </div>
                <div>
                      default:
                </div>
                <div>
                           return .Yellow;
                </div>
                <div>
                 }
                </div>
                <div>
                 <br>
                </div>
                <div>
                 really isn&#39;t much nicer than
                </div>
                <div>
                 <br>
                </div>
                <div>
                 let thisColor: Color
                </div>
                <div>
                 switch thatColor {
                </div>
                <div>
                      case .Red:
                </div>
                <div>
                           thisColor = .Green
                </div>
                <div>
                      default:
                </div>
                <div>
                           thisColor = .Yellow
                </div>
                <div>
                 }
                </div>
                <div>
                 <br>
                </div>
                <div>
                 Maybe we could do a compromise, something like
                </div>
                <div>
                 <br>
                </div>
                <div>
                 let thisColor = switch thatColor
                </div>
                <div>
                      case .Red: .Green // must be an expression
                </div>
                <div>
                      default: .Yellow      // must be an expression
                </div>
                <div>
                 <br>
                </div>
                <div>
                 Or we could introduce a new keyword? Like
                 <span> </span>
                 <b>match</b>:
                </div>
                <div>
                 <br>
                </div>
                <div>
                 let thisColor = match thatColor
                </div>
                <div>
                       case .Red: .Green    // must be an expression
                </div>
                <div>
                       default: .Yellow         // must be an expression
                </div>
                <div>
                 <br>
                </div>
                <div>
                 <br>
                </div>
                <div>
                 I sort of like the new-keyword approach, because even though this is similar to a switch, it&#39;s not a switch: there&#39;s no fallthrough, you can&#39;t put statements inside, etc.
                </div>
                <div>
                 <br>
                </div>
                <div>
                 The problem with all these proposals:
                </div>
                <div>
                 <br>
                </div>
                <div>
                 let thisColor = match thatColor
                </div>
                <div>
                      case .Red: match thatOtherColor
                </div>
                <div>
                                            case .Blue: .Green
                </div>
                <div>
                                            case .Pink: .Yellow
                </div>
                <div>
                                            default: .Orange
                </div>
                <div>
                      default: .Orange
                </div>
                <div>
                 <br>
                </div>
                <div>
                 is ambiguous. (Does case .Pink match thatColor or thatOtherColor? We can know because of exhaustiveness checking, but this won&#39;t always work.) You could solve this problem either by using parentheses around the whole expression when necessary
                </div>
                <div>
                 <br>
                </div>
                <div>
                 <div>
                  let thisColor = match thatColor
                 </div>
                 <div>
                       case .Red: (match thatOtherColor
                 </div>
                 <div>
                                             case .Blue: .Green
                 </div>
                 <div>
                                             case .Pink: .Yellow
                 </div>
                 <div>
                                             default: .Orange)
                 </div>
                 <div>
                       default: .Orange
                 </div>
                </div>
                <div>
                 <br>
                </div>
                <div>
                 or by adding curly braces in again
                </div>
                <div>
                 <br>
                </div>
                <div>
                 <div>
                  <div>
                   let thisColor = match thatColor {
                  </div>
                  <div>
                        case .Red: match thatOtherColor {
                  </div>
                  <div>
                                              case .Blue: .Green
                  </div>
                  <div>
                                              case .Pink: .Yellow
                  </div>
                  <div>
                                              default: .Orange
                  </div>
                  <div>
                                           }
                  </div>
                  <div>
                        default: .Orange
                  </div>
                 </div>
                </div>
                <div>
                 }
                </div>
                <div>
                 <br>
                </div>
                <div>
                 But that starts to look like switch again. (Of course, the best way to handle this is as a programmer is to just switch on the tuple (thatColor, thatOtherColor), but the language should allow for nested control expressions.)
                </div>
                <div>
                 <br>
                </div>
               </div>
               <div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                <br>
                <div class="gmail_quote">
                 On Sun, Dec 6, 2015 at 2:48 PM, Matthew Johnson via swift-evolution
                 <span> </span>
                 <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span>
                 <span> </span>wrote:
                 <br>
                 <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                  I am not a fan of this approach based on the ternary operator.  The ternary operator is already a bit of an anomaly in that all other operators are unary or binary and do not perform any control flow (beyond possibly short circuiting an autoclosure argument).
                  <div>
                   <br>
                  </div>
                  <div>
                   I would much rather features that perform control flow continue to use keywords, but allow them to be expressions.  
                  </div>
                  <div>
                   <br>
                  </div>
                  <div>
                   Once we have control flow expressions I would like to see the ternary operator removed from the language as it would no longer server a purpose.  Removing the ternary operator seems to fit nicely with the direction to remove some features that are carried over from C-based languages but don’t necessarily fit with the direction Swift is heading.
                  </div>
                  <div>
                   <div>
                    <div>
                     <br>
                    </div>
                    <div>
                     <div>
                      <br>
                      <div>
                       <blockquote type="cite">
                        <div>
                         On Dec 6, 2015, at 1:19 PM, Kevin Lundberg via swift-evolution &lt;
                         <span> </span>
                         <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:
                        </div>
                        <br>
                        <div>
                         <div>
                          <div>
                           Ostensibly, case may not be necessary if you could delimit each case on one line with something (perhaps a comma, or something else if that would not fit well within the grammar):
                           <span> </span>
                           <br>
                          </div>
                          <div>
                            
                          </div>
                          <div>
                           let thisColor = thatColor ? .Blue: .Red, .Green: .Blue, .Red: .Green, default: .Yellow
                           <span> </span>
                           <br>
                          </div>
                          <div>
                            
                          </div>
                          <div>
                           On Sun, Dec 6, 2015, at 01:57 PM, Paul Ossenbruggen via swift-evolution wrote:
                           <span> </span>
                           <br>
                          </div>
                          <blockquote type="cite">
                           <div>
                            I like this too, seems more powerful.  Also, would single line expressions be allowed?  If not would case be required for example:
                            <span> </span>
                            <br>
                           </div>
                           <div>
                             
                           </div>
                           <div>
                            <div>
                             <div dir="ltr">
                              <div>
                               let myFavoriteColor = yourFavoriteColor ?
                               <span> </span>
                               <br>
                              </div>
                              <div>
                                  
                               <span> </span>case .Blue: .Red
                               <span> </span>
                               <br>
                              </div>
                              <div>
                                  
                               <span> </span>case .Green: .Blue
                               <span> </span>
                               <br>
                              </div>
                              <div>
                                  
                               <span> </span>case .Red: .Green
                               <span> </span>
                               <br>
                              </div>
                              <div>
                                  
                               <span> </span>default: .Yellow
                               <span> </span>
                               <br>
                              </div>
                             </div>
                            </div>
                            <div>
                             <div>
                              <div dir="ltr">
                               <div>
                                 
                               </div>
                              </div>
                             </div>
                            </div>
                            <div>
                             <div>
                               
                             </div>
                             <div>
                              <blockquote type="cite">
                               <div>
                                On Dec 6, 2015, at 9:11 AM, Sean Heber via swift-evolution &lt;
                                <span> </span>
                                <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:
                                <span> </span>
                                <br>
                               </div>
                               <div>
                                 
                               </div>
                               <div>
                                <div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                 <div>
                                  I really like this train of thought. +1
                                  <span> </span>
                                  <br>
                                 </div>
                                 <div>
                                   
                                 </div>
                                 <div>
                                  l8r
                                  <span> </span>
                                  <br>
                                 </div>
                                </div>
                                <div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                 <div>
                                  Sean
                                  <span> </span>
                                  <br>
                                 </div>
                                </div>
                                <div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                 <div>
                                   
                                 </div>
                                 <div>
                                  On Dec 6, 2015, at 11:02 AM, Alex Lew via swift-evolution &lt;
                                  <span> </span>
                                  <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:
                                  <span> </span>
                                  <br>
                                 </div>
                                </div>
                                <blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                 <div>
                                  <div dir="ltr">
                                   <div>
                                    What if we left the if { ...} else { ... } syntax alone (as a statement), and updated the ternary expression to be a more general pattern matching expression (closer to &quot;switch&quot;)? Something like
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    let x = condition ?
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       true: &quot;Hello&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       false: &quot;Goodbye&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    let x = optionalValue ?
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       .Some(let unwrapped): &quot;Hello, \(unwrapped)&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       .None: &quot;To Whom It May Concern&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    let myFavoriteColor = yourFavoriteColor ?
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>.Blue: .Red
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>.Green: .Blue
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>.Red: .Green
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    let quadrant = (x, y) ?
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>let (x, y) where x &lt; 50 &amp;&amp; y &lt; 50: &quot;top left&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>let (x, y) where x &lt; 50 &amp;&amp; y &gt; 50: &quot;bottom left&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>let (x, y) where x &gt; 50 &amp;&amp; y &lt; 50: &quot;top right&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                       
                                    <span> </span>default: &quot;bottom right&quot;
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    The colon comes from the fact that this is sort of a light-weight expression-based &quot;switch&quot; statement, where each branch can only contain an expression, not a series of statements.
                                    <span> </span>
                                    <br>
                                   </div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    This is very similar to pattern matching expressions in languages like Haskell, ML, and Coq.
                                    <span> </span>
                                    <br>
                                   </div>
                                  </div>
                                  <div>
                                   <div>
                                     
                                   </div>
                                   <div>
                                    <div>
                                     On Sun, Dec 6, 2015 at 11:25 AM, Thorsten Seitz
                                     <span> </span>
                                     <span></span>
                                     <span dir="ltr">&lt;<a href="mailto:thorsten.seitz@web.de" target="_blank">thorsten.seitz@web.de</a>&gt;</span>
                                     <span> </span>
                                     <span></span>wrote:
                                     <span> </span>
                                     <br>
                                    </div>
                                    <blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                     <div style="word-wrap:break-word">
                                      <div>
                                       <div>
                                         
                                       </div>
                                       <blockquote type="cite">
                                        <div>
                                         <span>Am 06.12.2015 um 01:28 schrieb Alex Lew via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:</span>
                                         <span> </span>
                                         <br>
                                        </div>
                                        <div>
                                          
                                        </div>
                                        <div>
                                         <div dir="ltr">
                                          <div>
                                           <span>I don&#39;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:</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                            
                                          </div>
                                          <div>
                                           <span>if (condition) {</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                           <span>   <span> </span>funcWithSideEffectsThatReturnsInt()</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                           <span>} else {</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                           <span>   <span> </span>funcWithSideEffectsThatReturnsString()</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                           <span>}</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                          <div>
                                            
                                          </div>
                                          <div>
                                           <span>but that&#39;s not a valid expression (what is its type?).</span>
                                           <span> </span>
                                           <br>
                                          </div>
                                         </div>
                                        </div>
                                       </blockquote>
                                       <div>
                                         
                                       </div>
                                       <div>
                                         
                                       </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
                                        <span> </span>
                                        <span></span>
                                        <a href="http://ceylon-lang.org/documentation/1.2/tour/types/" target="_blank">http://ceylon-lang.org/documentation/1.2/tour/types/</a>).
                                        <span> </span>
                                        <br>
                                       </div>
                                       <div>
                                         
                                       </div>
                                       <div>
                                        In that case the type of such an expression would just be the union of both types, which is written
                                        <span> </span>
                                        <span></span>
                                        <span style="font-family:Courier">Int | String</span>
                                        <span> </span>
                                        <span></span>in Ceylon.
                                        <span> </span>
                                        <br>
                                       </div>
                                       <div>
                                         
                                       </div>
                                       <div>
                                         
                                       </div>
                                       <div>
                                        <span><span style="color:rgb(136,136,136)">-Thorsten</span></span>
                                        <span> </span>
                                        <br>
                                       </div>
                                       <div>
                                         
                                       </div>
                                      </div>
                                      <div>
                                        
                                      </div>
                                     </div>
                                    </blockquote>
                                   </div>
                                   <div>
                                     
                                   </div>
                                  </div>
                                  <div>
                                   <br>
                                  </div>
                                 </div>
                                </blockquote>
                                <blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                 <div>
                                  <div>
                                   <span>_______________________________________________</span>
                                   <span> </span>
                                   <br>
                                  </div>
                                  <div>
                                   <span>swift-evolution mailing list</span>
                                   <span> </span>
                                   <br>
                                  </div>
                                  <div>
                                   <span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span>
                                   <span> </span>
                                   <br>
                                  </div>
                                  <div>
                                   <span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span>
                                   <span> </span>
                                   <br>
                                  </div>
                                 </div>
                                </blockquote>
                                <div>
                                 <span style="font-family:Helvetica"><span></span>_______________________________________________</span>
                                 <span> </span>
                                 <br>
                                </div>
                                <div>
                                 <span style="font-family:Helvetica">swift-evolution mailing list</span>
                                 <span> </span>
                                 <br>
                                </div>
                                <div>
                                 <a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a>
                                 <span> </span>
                                 <br>
                                </div>
                                <div>
                                 <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
                                 <span> </span>
                                 <br>
                                </div>
                               </div>
                              </blockquote>
                             </div>
                            </div>
                           </div>
                           <div>
                            <br>
                           </div>
                           <div>
                            <u>_______________________________________________</u>
                            <span> </span>
                            <br>
                           </div>
                           <div>
                            swift-evolution mailing list
                            <span> </span>
                            <br>
                           </div>
                           <div>
                            <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>
                            <span> </span>
                            <br>
                           </div>
                           <div>
                            <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
                            <span> </span>
                            <br>
                           </div>
                          </blockquote>
                          <div>
                            
                          </div>
                         </div>_______________________________________________
                         <span> </span>
                         <br>swift-evolution mailing list
                         <span> </span>
                         <br>
                         <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>
                         <span> </span>
                         <br>
                         <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
                         <span> </span>
                         <br>
                        </div>
                       </blockquote>
                      </div>
                      <br>
                     </div>
                    </div>
                    <div style="margin-top:10px;font-size:12px;font-family:Helvetica,Arial;color:rgb(153,153,153)">
                     Untracked with
                     <span> </span>
                     <a href="https://trackbuster.com/?sig" style="color:rgb(153,153,153)" target="_blank">Trackbuster</a>
                    </div>
                   </div>
                  </div>
                  <br>_______________________________________________
                  <br>swift-evolution mailing list
                  <br>
                  <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>
                  <br>
                  <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a>
                  <br>
                  <br>
                 </blockquote>
                </div>
                <br>
               </div>
              </div>
             </div>
             <span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span>
             <span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span>
            </div>
           </blockquote>
          </div>
          <br>
         </div>
        </div>
       </div>
      </blockquote>
     </div>
     <br>
    </div> 
   </div>
  </blockquote>
 </div>
 <br>
</div>
<div style="margin-top:10px;font-size:12px;font-family:Helvetica,Arial;color:#999">
 Untracked with 
 <a style="color:#999" href="https://trackbuster.com/?sig" target="_blank">Trackbuster</a>
</div></div></div></blockquote></div><br></div>