3 ms·
Dynamic scope means you that whoever last bound the variable at runtime determines its value, not whichever outer scope surrounds it. I guess it would be somet
by trealira 3y ago
Dynamic scope means you that whoever last bound the variable at runtime determines its value, not whichever outer scope surrounds it.
I guess it would be something like this in pseudo code:
var dynamic = 5
function foo() {
print(dynamic)
}
function bar() {
var dynamic = 6
// foo() prints 6 due to the binding above
foo()
// After bar() exits, "dynamic" will go back to being 5
}