|
|
|
|
|
by pwpwp
5282 days ago
|
|
[Shadowing] prevents you from making use of the original value for the remainder of the current scope. That's totally false. In languages like Scheme, O'Caml, etc you are never prevented from using the original value. The point is that lexical, aka static scope is all about lexical pieces of code that you fully control, and all their properties are statically apparent, by looking at a single piece of code. Scheme: (DEFINE FOO 1)
(LET ((FOO 2)) ... FOO IS SHADOWED HERE ...)
Inside the LET, FOO is shadowed (FOO is "your FOO") and that's lexically, statically apparent by looking at the piece of code.If you don't want it shadowed, and use the global FOO, you just use another variable name. You cannot be prevented from using the original global FOO, because you choose the local variable names you use in a piece of code. |
|
Unless you're using a system in which non-hygienic macros are present and they expand into it...