On 9/8/14, 8:15 AM, Andrea Giammarchi wrote:
no introspection or nothing magic and weird, simply `.call(undefined)`
would do for sloppy and strict, preserving global in sloppy, avoiding
shenanigans in strict.

You seem to be assuming there is only one global involved again. Did you look at my testcase I posted earlier in this thread? Again, <http://fiddle.jshell.net/tmt5e9m6/2/show/>.

The behavior that testcase shows is not achievable by doing .call(undefined). If the web depends on that behavior (which is worth verifying if someone wants to experiment!), then we can't blindly do .call(undefined). Even if that is case, we _could_ still do .call(undefined) when the callee is strict, since I'm fairly certain the web does not depend on that behavior for strict callees, but that involves introspecting the strictness of the callee.

So we have three options, as I see it:

1) Keep existing behavior; always pass in a "this" value that's the window that was the "this" of the setTimeout call.

2) Change behavior for strict callees only. This involves introspecting the strictness of the callee, which is clearly doable in implementations, but weird and magical from the ES point of view.

3) Change behavior across the board to passing undefined as the this value, and deal with any resulting compat issues via evangelism.

Hence my curiosity: when this experiment was made, which code with `"use
strict"` failed ?

This only matters for option 2 above, right? The compat constraints for option 3 are all around sloppy functions, which is what most people use today. That's why I even brought up option 2: the question you were asking was presupposing that this option should be on the table.

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to