Definition 4: This value: in JavaScript this value is dynamically scoped, unless used in an arrow function.
That’s correct: as we know, the value of this is determined and provided exactly by the caller.
function produce() {
console.log(this.x);
}
const alpha = {produce, x: 1};
const beta = {produce, x: 2};
const gamma = {produce, x: 3};
console.log(
alpha.produce(), // 1
beta.produce(), // 2
gamma.produce(), // 3
);
instead of calling a function directly, the dyncall library provides a mechanism to push the function parameters manually and to issue the call afterwards.
Z. Zhao, B. Wu, M. Zhou, Y. Ding, J. Sun, X. Shen, and Y. Wu. Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, page 745--762. Association for Computing Machinery, (2014)
Z. Ling, and R. Wang. Proceedings of the 2007 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 4, page 1245-1248. Honolulu, HI, USA, (April 2007)
A. Ross, M. Hughes, and F. Doshi-Velez. Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, IJCAI-17, page 2662--2670. (2017)
M. French, {. Szepesvári, and E. Rogers. Proceedings of the International Symposium on the Mathematical Theory of Networks and Systems (MTNS 2000), (2000)