In Da Programming: BINDING

As it is mentioned in the subtitle, today’s topic is static and dynamic bindings. They are 2 crucial notations in programming and very necessary to know. First we will start defining each one and then scrutinize them in detail.

In book it is said that a binding is static if it first occurs before run time begins and remains unchanged throughout program execution. Basically, this variables, cannot change during the execution time. Opposite to static, if the binding first occurs during run time or can change in the course of program execution, it is called dynamic. So, I will write down this sentence to emphasize the complexity of the physical binding of a variable to a storage cell in a virtual memory environment. You may ask why this is like that and the ans we is simple. Because the page or segment of the address space in which the cell resides may be moved in and out of memory many times during program execution and as you have already understood, such variables are bound and unbound many times. I see, that you are already very much worried about how to handle all this bound unbound actions but, no need for that frustration. All bindings, are maintain by computer hardware, which means they are not visible to program and the user( YOU).

As is mentioned above, today’s topic is static but generally they are two, static and dynamic bindings, which are called type bindings.

Static Type Binding

Before diving to the deep phases, the is a necessity clarify some terminology, so you understand all very straight manner. We will start with explicit declaration and jump to implicit one.

An explicit declaration is a statement in a program that lists variable names and specifies that they are a particular type.

An implicit declaration is a means of association variables with types through default conventions, rather that declaration statements.

The 1st appearance of a variable name in a program constitutes its implicit declaration. Don’t let all these fancy words to trick you. Both explicit and implicit declarations create static bindings to types.

Just an extra information to make you relaxed, most widely used programming languages that use static type binding exclusively. Did you know that? I bet no! And most importantly, after mid-1960s it was a requirement to have explicit declarations of all variables, but as always we have special boys(exceptions), Visual Basic, ML, C# and Swift.

On the other side, implicit variable type binding(wow it is long to type) is done by the language processors. It can be a compiler or an interpreter. As it is mentioned in the book, there are several different bases for implicit variable type bindings and naming conventions is accepted as the simplest one, but how it is happening? Are you interested? Okay, will explain it in a sentence. Basically, the compiler or interpreter binds a variable to a type based on the syntactic form of the variable’s name. Are you happy now? Good to hear that!

Do you remember that we said at the beginning about implicit declarations that there is not much thing left to programmer? No no, it is true, but just do not get happy that quickly, because it has some drawbacks. Sad, but true! Implicit declarations can be detrimental to reliability because they prevent the compilation process from detecting some typographical and programmer errors.

Do not worry! If there is some, difficulties, be sure that someone has faced it before you, and most luckily it has some remedies already. In this case, not all but some of the problems with implicit declarations can be avoided by requiring names for specific types to begin with particular special characters. Yes, that simple. Nice to see you happy. Now, let me give an example. For instance, in $ sign indicates scalar which can store either a string or a numeric value. If the starting sign is @, then it means this variable is an array, and starting with a % indicates the variable being a hash structure. This create different namespaces for different type variables also, this increase readability.

There is another kind of implicit type declarations which I was not thinking to mention when I start to write down. Since, you loved the topic (how I know, because you have come this far, and do still read this silly sentence) I will explain that as well. In this kind context is used and another common name of this is called type inference. Lets explain this with an example,

The value they get are context and as you see the sum gets integer(because 0 is integer), total get float(same scenario, but this time float), and lastly name gets string. Oh almost forgot, these are statically typed variables which means their types are fixed for the lifetime of the unit in which they are declared. You cannot change the types.


  1. Sebesta, R. W. (n.d.). Names, Bindings and Scopes. In Concepts of Programming Languages (12th ed., pp. 203–205).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store