Strict mode created a new invariant worth protecting. The erasure of arguments.caller sealed a leak of information from dynamic scope.
Strict mode also nixed the arguments property of functions. That eliminated both a reëntrancy hazard and leakage of dynamic scope.
function foo() {
console.log(bar.arguments);
// [10]
}
function bar(a) {
foo();
}
bar(10);
I’m not the most confident orator on the topic, but eliminating dynamic scope creates a desirable language invariant.
A program that involves parties Alice, Bob, Carol, and Dave, Alice should be able to pass an object from Dave to Bob by calling a function. Bob should then be able to call a function of Carol but should not be able to eavesdrop on the arguments Alice passed to Bob, and thereby gain access to the object from Dave.
This invariant is important in evaluating future proposals for a stack trace API and any implicit context propagation proposals.
so, if i am reading this right, the goal of this invariant is to maintain the integrity of information contained in scopes currently offered by "use strict"?
Strict mode created a new invariant worth protecting. The erasure of
arguments.caller
sealed a leak of information from dynamic scope.Strict mode also nixed the
arguments
property of functions. That eliminated both a reëntrancy hazard and leakage of dynamic scope.I’m not the most confident orator on the topic, but eliminating dynamic scope creates a desirable language invariant.
A program that involves parties Alice, Bob, Carol, and Dave, Alice should be able to pass an object from Dave to Bob by calling a function. Bob should then be able to call a function of Carol but should not be able to eavesdrop on the arguments Alice passed to Bob, and thereby gain access to the object from Dave.
This invariant is important in evaluating future proposals for a stack trace API and any implicit context propagation proposals.