Echo JS 0.11.0

<~>

venkman comments

venkman 4648 days ago. link 1 point
I'm sorry, but to me this doesn't look like a good explanation of what closures *are*. Instead, it looks like a badly explained recipe. Some sort of set of magic steps to follow to reach some undetermined goal.

I'm sorry if I sound too harsh, but really the article progresses and we do not even know where we are going or what we're trying to achieve. Not only that, but each step sort of appears out of nowhere. It's not a case of "right now we have this problem so we fix it changing this" but one of "hey, let's look at this code I already have here; see that it does something interesting".

Also, there're some contradictions. E.g. "let's introduce a global variable. Not global global, but in the scope of the function..." and just after that "but that forces us to introduce a global variable". Is it global or is it not? And why fumble around with that without explanation? Because, hey, the *whole*point* of closures is that there are references "just available in the scope of the function".

Finally, that last paragraph is not only confusing but plain wrong.
venkman 4712 days ago. link 1 point
With all due respect, while the article tries to be thorough and that is good, some of the explanations are confusing and even misleading.

As an example, the author says this (about halfway through):

> This means that the scope of a function is always the context in which it executes, not the context in which it was defined.

Which, clearly, is not only wrong but, if true, would make for closures (explained further down) to simply not work. Because, well, that's exactly how closures work, by accessing the context in which the function was defined.

Where is the problem? The problem lies in the confusion between the *thisBinding* reference and the *context*, which the author takes to be the same but in fact are not.