Re:Dynamic Scoping in C++
by jupp0r on Monday September 21, 2020 @12:07PM
(#24545023)
Dynamic scoping moves a bunch of correctness checks from compile time to runtime. It basically introduces all the problems that come with shared mutable state across different functions/methods. It becomes hard to reason about who mutates state where/when.
[ Parent
| on HN ]
Exactly. I read this:
Ergo, dynamically-scoped variables are shadowable side-channels that can influence the behavior of a function
And thought that is exactly why not to use dynamic scoping. It makes every function impure by default.