01:25
<Jack Works>
hi bakkot I have to say I really like the alternative design of do expression (https://github.com/theScottyJam/proposal-statements-as-expressions/issues/3)
01:25
<Jack Works>
IMO that's the real meaningful way to turn statements into expressions
01:25
<Jack Works>
without the complex early errors that do expressions currently have
01:26
<Jack Works>
and my idea in the link above also allows the "temp variable" case.
01:27
<Jack Works>
To be short: We add if expression and try expression. (throw expression has it's own proposal, switch has pattern matching as the expression version)
01:28
<Jack Works>
Then we add a ExprBlock, that in the form of
expr {
OneOrMore Declaration or Expression
Expression
}
01:29
<Jack Works>

So we can do

const sth = expr {
    const tmp = random()
    tmp * tmp
}
01:30
<Jack Works>
meanwhile for loop, break, continue, return, if-without-else are naturally syntax error in the form above.
01:31
<Jack Works>
That brings more composable syntax sets for developer to use (if expression, try expression, pattern matching, throw expression, expression block, ...)
01:32
<Jack Works>
cc HE Shi-Jun I guess you will like this idea too
01:35
<Jack Works>
(and I still don't think using break continue and return in the expression position is a good idea)
06:31
<bakkot>
Jack Works: thanks for the suggestion, I'll take a look in a bit
06:44
<Jack Works>
Jack Works: thanks for the suggestion, I'll take a look in a bit
I have posted into the GitHub issue