Obviously if/switch expressions are more like statements than functions/closures:
- no "in"
- no closure / capture list
- can't assign the "uncalled form" to a variable, pass that variable around and call that variable later on
- can't have a return (at least in a "single statement" if expression) while there is no problem of having "return" in a single statement function/closure.)
- no "non trailing closure" form:
let x = if (true, then: {1}) // 🛑
let x = if (true, then: {1}, else: {2}) // 🛑
Thanks for the reminder! Reviewing that thread I found that using "return" to mean "expression value" was also regarded as confusing (see discussion for Option #1 linked below).
This, this and this post are particularly interesting. As a compromise solution I like (Option #5), makes sense (bare last expression in if/switch statements, explicit return in functions/closures).