Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
7 user(s) are online (7 user(s) are browsing encyclopedia)

Members: 0
Guests: 7

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Name binding

In programming languages, name binding refers to the association of identifiers with Runtime entities such as objects and functions. An identifier is bound when it is associated with an actual object. Because of this, name binding is closely related to object lifetime. Name binding bridges the conceptual gap between the program as described by its source code, and the program as it actually executes at runtime.

When discussing binding for compiled languages we often pretend that the program is executed in its source code form, because the actual identifiers do not actually exist anymore at runtime. In these cases, the binding process is merely an imaginary conceptual process.

= Binding at multiple levels =

Consider the following Java programming language code:

String s; s = bar ; s = null;

While s is not bound to an actual Java object when it is introduced, it is bound to an implicit reference object that is capable of referring (binding) to an actual Java object. One could say that s is bound the moment it is assigned an object to refer to, but clearly this is a different level of binding. Similarly, the last line unbinds s in that it is no longer associated with an actual Java object, but it is still associated with an implicit reference object. Thus, binding can occur at multiple levels.

= Binding time and scoping types =

In interpreted languages, all binding takes place at Runtime.

A binding is static if it occurs before a program runs; it is dynamic if it occurs at run time. Static binding are somtimes refereed to as early bindings , and dynamic bindings are referred to as late bindings .

Due to the multi-level and conceptual nature of binding in compiled languages, it is often hard to say if and when binding takes place. For example, while the identifier-to-memory-offset translation of C programming language local variables is performed at compile time, the absolute address of the variable is not known until the function is actually executed at runtime (not taking optimization into account).

Binding time and type of variables (in particular local variables) is heavily influenced by Scope (programming). In particular, lexical or static scoping is also known as deep binding, while dynamic scoping (which more or less takes place at runtime) is also known as shallow binding. See Scope (programming)#Static_versus_dynamic_scoping. Dynamic scoping requires the binding process to have a runtime aspect, since it depends on the program state.

One example of a type of binding that clearly has a very significant runtime aspect is dynamic dispatch (also called dynamic binding), where the entity that an identifier is bound to is determined based on information that is only available at runtime (such as the runtime type of the object that a virtual function is being called on).

For named objects with static duration such as simple functions and global variables, binding takes place at compile or link time: the binding is fixed during the execution of the program, and is as such static.

= See also =

  • dynamic dispatch
  • Scope (programming)