Continuing woes in reading the ES6 spec language

Oliver Hunt oliver at
Fri Sep 13 10:18:42 PDT 2013

On Sep 13, 2013, at 9:58 AM, Andreas Rossberg <rossberg at> wrote:

> On 13 September 2013 18:39, Oliver Hunt <oliver at> wrote:
>> The problem with temporal dead zones is that they lead to weird behaviour in edge cases, and almost all of them should be syntactically identifiable as errors up front.  The problem is that you can only _almost_ get syntax checked behaviour upfront because eval.
> There must be a misunderstanding -- eval is not relevant to the issue
> that TDZ is addressing.  The issue is mutual recursion between
> bindings that can perform arbitrary (higher-order) computations.  In
> that situation, it is generally impossible to ensure the absence of
> errors without a type system.  And even with one, it is tedious to the
> degree that it is arguably impractical.  So, as long as JavaScript
> allows that (and I don't see how we can change that), TDZ is the
> best/only we can do.
> What "weird edge case" do you have in mind? I cannot imagine anything
> that isn't even weirder without TDZ.

It isn't eval doing anything magic here - you can syntactically identify and use of not yet live properties, except eval(), e.g.

function f1(a=b, b=...) ... // can syntax error easily
function f2(a=function () {return b}, b=...) ... // again you can syntax error, or you can be clever and say we're not calling it and not error
function f3(a=function () {return b}(), b=...) ... // syntax error as we can prove you're going to use b
function f4(a=eval("b"), b=...) ... // eval makes things opaque

Personally I don't believe TDZ's are a good solution - they essentially add another null/undefined value internally.  They make things more complex for developers.

I certainly don't get what the TDZ win is for default parameters, and example would help me reason about it.

> /Andreas

More information about the es-discuss mailing list