domenic / proposal-blocks

Former home of a proposal for a new syntactic construct for serializable blocks of JavaScript code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Block or function scope?

jakearchibald opened this issue · comments

await worker({|
  var foo = 'bar';
|});

Does the above create a variable scoped to the block, or a syntax error?

As a would-be user of this syntax, I'd expect a syntax error here.

Per the last paragraph of https://github.com/domenic/proposal-blocks#the-basic-idea, it creates a variable scoped to the block/function body.

Ah, sorry, missed that bit.

I think this is another reason a function-like syntax would be clearer #5.