Users and applications
Formal description
Use in data structures
Architectural roots
Making pointers safer
Simulation using an array index
Project partners & contact details
Name binding
In programming languages, name binding is the association of entities (data and/or code) with identifiers. An identifier bound to an object is said to reference that object. Machine languages have no built-in notion of identifiers, but name-object bindings as a service and notation for the programmer is implemented by programming languages. Binding is intimately connected with scoping, as scope determines which names bind to which objects at which locations in the program code (lexically) and in which one of the possible execution paths (temporally).
Use of an identifier id in a context that establishes a binding for id is called a binding (or defining) occurrence. In all other occurrences (e.g., in expressions, assignments, and subprogram calls), an identifier stands for what it is bound to; such occurrences are called applied occurrences.
List is an interface, so list must refer to a subtype of it. Is it a reference to a LinkedList, an ArrayList, or some other subtype of List? The actual method referenced by add is not known until runtime. In C, such an instance of dynamic binding may be a call to a function pointed to by a variable or expression of a function pointer type whose value is unknown until it actually gets evaluated at run-time.
The identifier list initially references nothing (it is uninitialized); it is then rebound to reference an object (a linked list of strings). The linked list referenced by list is then mutated, adding a string to the list. Lastly, list is rebound to null.