<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">All,</div><div class=""><br class=""></div>I have continued work on my proposal. I am trying to gauge whether people feel that this syntax which is currently in the proposal is better or worse than the last two variations. &nbsp;The current proposal syntax:<div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">let a = ?(x == y: a, b)</font></div><div class=""><font face="Menlo" class="">let b = ?(colorEnum : Red: 0xFF0000, .Green: 0x00FF00, .Blue: 0x00000FF, default: 0xFFFFFF)</font></div><div class=""><font face="Menlo" class="">let c = ?(pickOne : “A”, “B”, “C:, default: “Z”)</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">The preceding is the unified ?( operator approach and is the closest to the existing ternary. but expands its capabilities to support more types of control than just bool. It is the most concise and adds no new keywords. It determines the kind of expression based upon the format inside the braces. The next version is the full keyword approach which has the same capabilities but separates each kind out: &nbsp;</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">let a = if(x == y then "A" else "B")</font></div><div class=""><font face="Menlo" class="">let b = switch(colorEnum then .Red: 0xFF0000, .Green: 0x00FF00, .Blue: 0x00000FF, default: 0xFFFFFF)&nbsp;</font></div><div class=""><font face="Menlo" class="">let c = select(pickone then "A", "B", "C", default: "Z”)</font></div><div class=""><br class=""></div><div class="">or to avoid a new keyword and be slightly more concise. This one is the hybrid approach:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">let a = if(x == y : "A" else "B")</font></div><div class=""><font face="Menlo" class="">let b = switch(colorEnum : .Red: 0xFF0000, .Green: 0x00FF00, .Blue: 0x00000FF)&nbsp;</font></div><div class=""><font face="Menlo" class="">let c = select(pickone : "A", "B", "C", default: "Z")</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">Note that the use of parenthesis outside the entire expression in these is to emphasize that these are expressions, can be read almost like a regular function, they serve to group the entire expression, and they would be required around the full expression only the leading keyword is outside. This will disambiguate it from the statement form. Braces are for statements and parenthesis for expressions. Putting the “then”and “else” part inside the parens also avoids the problem of “then” with the following format:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">x = if cond then A else B</font></div><div class=""><br class=""></div><div class="">With this we would have support “then” in the “if" statement form and it is hard to tell it from the statement form. By putting it in parenthesis, we can put whatever we want in there.&nbsp;</div><div class=""><br class=""></div><div class="">&nbsp;The advantage of the second or third approach is the syntax would be custom to each kind so additional checking could be performed to ensure it is correct for the keyword provided. The keywords would be context sensitive so may not interfere with other uses of it.&nbsp;</div><div class=""><br class=""></div><div class="">These last two possibilities may address some of the issues that Jordan Rose brought up…the first is the double colon, for the separator and for the cases. The issue he mentioned second is that he did not feel my proposal addressed any of the problems with the ternary, and third he wants to keep the ? just for optionals. If the colon to separate the control, in the last one is not good, I am open to suggestions for other separators, but keep in mind, that goes even further from the ternary which may or may not be a good thing.</div><div class=""><br class=""></div><div class="">I think I would be happy with any of these. If the consensus is that either of the last two are preferable, I will rewrite the proposal with that in mind. Please let me know if you have any questions or have other suggestions.&nbsp;</div></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">- Paul</div><div class=""><br class=""></div><div class="">For latest version of proposal and see Alternatives Considered section for more details on this:&nbsp;</div><div class=""><a href="https://github.com/possen/swift-evolution/blob/master/proposals/0024.md" class="">https://github.com/possen/swift-evolution/blob/master/proposals/0024.md</a></div><div class=""><br class=""></div></body></html>