Brendan Eich wrote:
>> What did you mean by "had better fail to compile"? Other than the
>> type annotation, there is nothing about
>>
>> function f() {
>> x = 15;
>> ...
>> var t = some_runtime_expression;
>> ...
>> var x:t = ...
>> }
>>
>> that ought to fail to compile.
>
> The assignment to x in that temporal dead zone before t's initializer
> has been evaluated.
>
> Why is this different if you s/var x/let x/?
Ah, ok. That's good news! For a long time I wanted to make statically
detectable uses of a variable before its let or const declaration runs to be
compile-time errors. You can't detect all of them due to closures, but you can
detect most in practice. I'm glad you agree.
Waldemar
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss