Re:Children's mental models of recursive LOGO programs (1985)
by trealira on Thursday July 11, 2024 @04:59PM
(#40940557)
Most programming languages today don't have dynamic scoping. Here's something you could do in a language that had it.
In a language with dynamic scoping, this would print:
With lexical scoping, most dynamically scoped code would either be a compilation error, or it wouldn't work. In this case, the language would complain that x wasn't defined in the scope of "print_x()". With lexical scope, you'd have to make x a global variable, and then the function foo() would just be equivalent to calling print_x().
[ Parent
| on HN ]
There are no comments on this comment yet.