3 ms·
Dynamic scoping doesn't require long variable names. Having one namespace is what requires global variables to have reasonably long names. Under dynamic scope
by kazinator 7y ago
Dynamic scoping doesn't require long variable names. Having one namespace is what requires global variables to have reasonably long names.
Under dynamic scope you have the additional problem that a global name can be be overridden by accident by local names that clash with it.
Rather than trusting mere identifier length to address that problem, there is a namespacing convention to deal with it: putting "earmuff" asterisks on the names of global variables.
- namelosw 7y agoNamespace and lexical scoping can both solve the long variable name issue. If a language have none like Emacs Lisp or CSS, the issue happens. For example, when there was no namespace for JavaScript, people can easily simulate modules/namespaces with lexical closures. For a lot (not all of course) of bundling systems, modules/namespaces are just syntactic sugars on top of lexical closure.