Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Namespace 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: