domenic at domenicdenicola.com (2014-02-18T04:40:53.417Z)
How about this?
```js
let x= 0;
if (1) eval("let x= 42; alert(x);"); //Is this in its own block?
alert(x);
```
On 31/01/2014, at 03:11, Brendan Eich wrote:
> OMG LETS MAKE USELESS LETS EVERYWHERE LOLJSSUXZ0RZ! Um, no.
:-)
On 30/01/2014, at 17:13, Brendan Eich wrote: > John Barton wrote: >> >> On Thu, Jan 30, 2014 at 7:54 AM, Brendan Eich <brendan at mozilla.com <mailto:brendan at mozilla.com>> wrote: >> >> John Lenz wrote: >> >> Generally, I've always thought of: >> >> "if (x) ..." as equivalent to "if (x) { ... }" >> >> >> let and const (and class) are block-scoped. {...} in your "if (x) >> {...}" is a block. An unbraced consequent is not a block, and you >> can't have a "conditional let binding". >> >> The restriction avoids nonsense such as >> >> let x = 0; { if (y) let x = 42; alert(x); } >> >> What pray tell is going on here, in your model? >> >> >> I'm with John: the alert should say 0 and I can't see why that is not obvious. > > Interesting! > > You don't want the alert to show undefined, so the extent of the inner binding in your model is the unbraced consequent of the "if". > > That is not "block scope" in any plain sense. How about this? let x= 0; if (1) eval("let x= 42; alert(x);"); //Is this in its own block? alert(x); On 31/01/2014, at 03:11, Brendan Eich wrote: > OMG LETS MAKE USELESS LETS EVERYWHERE LOLJSSUXZ0RZ! Um, no. :-) -- ( Jorge )();