static

A Review of Static and Dynamic Scoping in Programming Languages

All programming languages allow names to be associated with values by means of definitions, and a name is said to be in the scope of its definition. When a name is mentioned in a program, its definition (if any) must be known, in order for its invocation to make sense. However, most languages allow names to be re-defined in a program – the rules for determining to which definition a name refers, are called the scoping rules.
There are two principal scoping methods: static and dynamic. This post will firstly explain these two concepts, comparing their similarities and differences. The uses of the two methods will be discussed, illustrating these with code from actual programming languages. Finally the essay will conclude with a critical summary of the pros and cons of static and dynamic scoping for present day programming problems.

Read More…

 Scroll to top