-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scoping vs Scopes suggestion #8
Comments
Interesting points!
My understanding is: a variable is declared during the first pass the JS Our to put another way; let & var do share the same mechanism of
I'm inclined to leave details like that out of the workshop so it doesn't
Is there a specific example in the workshop where you feel it could be
|
I agree with you. I would not either include anything about Dynamic Scoping into this workshop. My point is just that Lexical Scoping should not be contrasted with Block Scopes. Lexical Scoping is about how names are resolved in nested scopes, no mather how and where are those names declared (var or let, current or parent scope). Lexical Scoping mechanism might be explained in "Nested Scopes" chapter. Here are some good resources, explaining above in much more details: Thanks, |
Oh, right, that makes way more sense - I completely miss-understood your original post, sorry. I'll do some research (thanks for the links) and see what makes most sense to use. Thanks for opening this issue. |
That's ok...obviously I didn't articulate it clearly enough ... We are now at the same page...great :) Thanks, |
I agree this should have some thought put into it, but we really need to think about this change. Currently, ''function scope javascript" has ~7.7m results but none very specific to the thing we're talking about. On the other hand, "lexical scope javascript" has only ~77k results, but they all talk about what we're talking about.. lexical variables. There have been other workshops that have knowingly used slightly incorrect terms because it makes it much easier for newcomers to understand/google. |
@SomeoneWeird Good point. Although I feel it's the responsibility of this workshop to get it right (especially as it's listed under "Core" on nodeschool.io), even if that means not being as google-able. I guess the point to be made is that up until |
Hi,
just a comment regarding scopes and scoping. I find some points in workshop to be little confusing, so I'll try to articulate it in couple of sentences.
Scoping is related to how the scope chain is created. In Lexical or Static Scoping, "parent" scope of some "child" scope is determined by the place in source code where it is defined. So, the scope chain is created at the place where the certain scope (function/block) is defined. On the other hand, Lexical Scoping is contrasted by Dynamic Scoping, where scope chain is created dynamically in the place where the function is called (http://c2.com/cgi/wiki?DynamicScoping). All popular programming languages that I am aware of are Lexically Scoped.
Now, scope itself could be defined by block, function, module, etc.
So, I think it is not correct to say that variable created by var is lexically scoped and variable created with let – block scoped. Lexical scoping cannot be contrasted with block scope. var creates function scoped variables and let creates block scoped variables. Variables created with let are still Lexically Scoped, because its parent scope is determined the same way as for variables created with var, by the place where it is defined.
The text was updated successfully, but these errors were encountered: