3 ms·
While the opinions of Mssrs. Steele and Stallman should not be lightly dismissed, and I think I can see where they are coming from, the marketplace of programmi
by mannykannot 8y ago
While the opinions of Mssrs. Steele and Stallman should not be lightly dismissed, and I think I can see where they are coming from, the marketplace of programming languages seems to have voted against dynamic scoping to an extent that it has not, for example, chosen definitively for or against static typing. Dynamically-scoped variables are rather like globals, but with the added complication that each one is a stack.
- repsilat 8y agoConcrete solutions to Stallman's objection in lexically scoped languages include, - Callable objects that store `FOO`, and - Closures that capture `FOO`. I'm pretty leery of argumentum ad populum. I think we went with lexical scoping for a few clear reasons, and I don't know if the reasons for dynamic scoping are compelling. I would love to hear more of them, though.
- mannykannot 8y agoMy comparison of dynamically scoped variables to globals might be wrong, but, unlike my comment on the way languages have developed, it is not an argumentum ad populum. It has been a while since I worked with dynamically-scoped programs, but I found it harder to reason about how they worked. Maybe it was just because I was less familiar with the technique. It might be that all forms of beyond-local scoping multiply the difficulty in reasoning about programs (especially in the presence of mutable data), and dynamic scoping is a more powerful form of it, increasing the opportunity for setting up difficult-to-follow situations. The issue of ease of understanding is a different one than ease of extending, and I would judge the former to be more important, all else being equal.