In Da Programming: BINDING
The word binding is used in any sphere of life and as it is understood from the title, yes we do have binding in programming too, and it is highly important to know.
Simply to emphasize,a binding is an association between an attribute and an entity
- binding between a variable and its type or value
- binding between an operation and a symbol
Everything in life takes time as is binding but not every spent time has a special naming unless we are not talking about binding.
The time at which a binding takes place is called binding time.
Now we reach to the point where the fun begins. Since the concept is time, it should have start and end(unless not starts from eternity and goes to infinity), therefore, I will shortly drop down a list of time ranges where binding process can happen. Before I do, I really find it crucial to emphasize that binding and binding times are prominent concepts in the semantics of programming languages and it must be understood well.
Here we go, bindings can take place at
- Language design time — for example, the asterisk symbol(*) is usually bound to the multiplication operation at the design time.
- Language implementation time — for example, a data type, let’s say int in C, is bound to a range of possible values at language implementation time.
- Compile time — for example, a variable in Java program is bound to a particular data time in compile time.
- Load time — for example, a variable may be bound to a storage cell when the program is loaded into memory, which is load time.
- Link time — for example, a call to a library subprogram is bound to the subprogram code at link time.
- Run time — for example, variables declared in Java methods are bound in run time.
Example: in this example C++ assignment statement has taken into hand and we will investigate different bounding spheres
count = count + 5;
- Compile Time: the type of the count is bound
- Compiler Design Time: the set of possible values of count is bound
- Compile Time: the meaning of the operator symbol + is bound, when the types of its operands have been determined.
- Compiler Design Time: the internal representation of the literal 5 is bound
- Run Time: the value of count is bound.
- Sebesta, R. W. (n.d.). Names, Bindings and Scopes. In Concepts of Programming Languages (12th ed., pp. 203–205).