Pitch: Multi-statement if/switch/do expressions

I agree and I like the chosen keyword. I'm not really a fan of bike-shedding too much either. It feels the pushback is in a few categories.

  1. People think it is confusing because it reminds them of if/then/else and then is being used differently here.

  2. They prefer implicit return. I personally like implicit return in functional contexts too, but the more I've thought about this I think it will be mostly to add some imperative code in to expressions. The "Full Expression" future direction may allow the "then" keyword to be used less often which may satisfy people who prefer implicit return.

  3. They prefer blocks in an expression to act like an immediately executed closure and use return. I'm not a fan of this because I think it unnecessary restricts future evolution of the language and doesn't allow some common patterns in imperative code that I think are still appropriate.

1 Like