4 ms·
Why do you believe that JavaScript isn't lexical? My understanding is that it is. Do you mean the behavior of `this`? Its similar to Lua in that `this` is actua
by spion 7y ago
Why do you believe that JavaScript isn't lexical? My understanding is that it is. Do you mean the behavior of `this`? Its similar to Lua in that `this` is actually an implicit function argument (passed left of the dot) but thats definitely very different from say, dynamic scope
Prototypical inheritance isn't a "deep" design mistake in so far that its not actually used as such (its mostly used as classical inheritance). Classical inheritance could be argued a design mistake, but one that most mainstream languages make, so I wouldn't go as far as to call it a deep one.
- lmm 7y ago> Why do you believe that JavaScript isn't lexical? My understanding is that it is. Do you mean the behavior of `this`? Its similar to Lua in that `this` is actually an implicit function argument (passed left of the dot) but thats definitely very different from say, dynamic scope `this` but also hoisting - variables get hoisted out of blocks where they are declared, so their scope is not what it looks like lexically. > Prototypical inheritance isn't a "deep" design mistake in so far that its not actually used as such (its mostly used as classical inheritance). I'd argue that even if it's not being used it still adds complexity when reading or debugging.
- spion 7y agoHoisting is still lexical, except the scope is function level. But the point is moot, since we have `let` which behaves "normally" now. `this` is not non-lexical scope, its argument passing. Its the most confusing wart in JS but its actually not a fundamental design flaw, just a syntactic wart: https://gist.github.com/spion/7180482 https://gist.github.com/spion/7180482 > I'd argue that even if it's not being used it still adds complexity when reading or debugging. I disagree, it barely adds a couple of bits of noise here and there. Definitely not a deep flaw. The worst JS flaws are in its anemic standard library and the pre-promises backend standard library included with node. They are overdue for a refresh.