8 ms·
> it'd be surprising in any case to encounter dynamic scope in Javascript, a language which does not even support it. Doesn't matter much, but just b.c. it's i
by pcr910303 7y ago
> it'd be surprising in any case to encounter dynamic scope in Javascript, a language which does not even support it.
Doesn't matter much, but just b.c. it's interesting: JavaScript actually does support limited dynamic scoping - `this` is scoped dynamically like in usual Lisps, and there's a with statement[0] that acts somewhat similar with `let` in Lisp.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- desert_boi 7y ago`with` is not allowed in strict mode (from ES5) and with ES modules (which imply strict). It's a bit of a relic.