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

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 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 scoping. 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 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 method 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

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools