

It's like nobody actually tried the code because the code is still objectly broken. And again, this is the answer that got a lots and lots of upvotes. And then therefore, it'll be able to reference the bar.
And that will somehow magically, kind of import that function back into my local lexical environment. So, I'll say, this.baz is equal to baz, and then I'll invoke that function as my own local context. They said, okay, well, what I really need to do is I need to make that baz function, I need to make a local reference to it. This is the distillation of the way they tried to solve this problem. I want to show you how incorrectly they tried to solve this problem. So, I just want to caution you against that. It's a testament to the fact that people are not rationally thinking about the, this, mechanism the way it actually works, they're thinking about it the way they want it to work. And yet thousands of people have upvoted it as the correct answer, and people are giving it the green check mark and saying well this is obviously the right code. And I was dismayed to scroll down a little bit, and to see the first answer was the one with the big green check mark on it, and it literally had several thousand up votes, and I looked at the code that was posted, and I'll show you again the distillation of the code that was posted, it is abjectly wrong. This is what I'm attempting to do and it doesn't work. Again, it was a different form of the code, but I've distilled it down to the problem. So this question was post on stack overflow, I'm attempting to do this. So we don't have a way to tell them, make this point to my electable context, and yet people attempt to do this. It's a thing that exists, but we get no reference to it in our code. We don't have any reference to our own local lexical context. And so what you can see here is they're trying to get this reference to somehow magically local lexical context. Here I'm trying to say I want to call this function in such a way and make it so that that bar variable references my bar variable. But there's an attempt that people make to do this, and it's a well meaning and well spirited attempt. They're just two fundamentally different mechanisms and they don't cross over. What I will say, plainly, is it is impossible to create a crossover between the lexical environment and the, this, binding mechanism. And that may or not be something you've ever attempted to do, but people attempt to do this, where they take some function, and make it reference their own local lexical environment, make the this reference somehow cross over to their own lexical environment. And they wanna be able to invoke that function in some way that when he makes a this.reference, it will reference their own local copy of the variable. And then they have a function that they do control, like the function foo, and they've got a local variable inside of their function called bar. So they don't have any control over it, but they know that that function makes a reference to something like, this.bar.

Like the baz function here on lines five through seven, maybe that one's declared as part of a third party utility that they don't control. And the way that it usually occurs is, somebody has some other function somewhere. And it's not the only one, where people try to create this connection between these two models that we've presented, between the lexical scoping mechanism, and the this scoping mechanism. And I'm not just making this up, this is actually, this is fake code, but this is distilled from an actual question on stack overflow that I ran across. > Kyle Simpson: So I want to take just a little detour here and talk about some binding confusions. Transcript from the "Binding Confusion" Lesson
