Values from scoped blocks: Does proposal exist?

Hello! New here, a little unsure how to find things.

I am wondering if a proposal exists, or existed but died (is that a thing?) for values from scoped block statements. (I am not looking to suggest the feature, only to find discussion notes about it.)

Send value out of block:

let foo;
{ /* scoped code */ foo = 5 };

Get value out of block?:

let foo = { /* scoped code */ 5; } //5 is last expression in block

(The above syntax would be confusing. I don't know what syntax would have been proposed.)

I read through the proposals at Is there somewhere else I should be looking for things like this in general?

The do block proposal is probably what you're looking for. It currently looks like this:

const foo = do {
  const x = f()
  const y = g()
  x + y
// foo will be equal to x + y

Thank you! I saw that proposal, but did not make the connection.
That syntax makes me very happy. I hope it arrives. :grin:

1 Like