FACTOID # 81: Two-thirds of the world's kidnappings occur in Colombia.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Dynamic polymorphism

In programming languages, name binding refers to the association of values with identifiers. An identifier bound to a value is said to reference that value. Since computers themselves have no notion of identifiers, there is no binding at the assembly level — name binding is an abstraction provided by programming languages. Binding is intimately connected with scoping, as scope determines when binding occurs. A programming language or computer language is a standardized communication technique for expressing instructions to a computer. ... Value is a term that expresses the concept of worth in general, and it is thought to be connected to reasons for certain practices, policies, or actions. ... Identifiers (IDs) are lexical tokens that name entities. ... In general, a reference is something that refers or points to something else, or acts as a connection or a link between two things. ... Assembly may refer to the following things: In politics, any body meeting together to discuss matters, a parliament or a legislative assembly such as the French revolutionary Legislative Assembly, or a body more designed to mediate between otherwise independent bodies, such as the United Nations General Assembly. ... // An abstraction is an idea, concept, or word which defines the phenomena which make up the concrete events or things which the abstraction refers to, the referents. ... In computer programming in general, a scope is an enclosing context. ...


Rebinding and Mutation

Rebinding should not be confused with mutation — "rebinding" is changes to the referencing identifier; "mutation" is changes to the referenced value. Consider the following Java code: In biology, mutations are permanent, sometimes transmissible (if the change is to a germ cell) changes to the genetic material (usually DNA or RNA) of a cell. ... Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. ...

 LinkedList<String> l; l = new LinkedList(); l.add("foo"); l = null; 

The identifier l at first references nothing (the null object); it is then rebound to reference an object (a linked list of strings). The linked list referenced by l is then mutated, adding a string to the list. Lastly, l is rebound to the null object.


Binding time

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.


An example of a static binding is a direct C function call: the function referenced by the identifier cannot change at runtime. An example of dynamic binding is dynamic dispatch, as in a C++ virtual method call. Since the specific type of a polymorphic object is not known before runtime (in general), the executed function is dynamically bound. For example: The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a low-level standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the... In computer science, dynamic dispatch is the process of mapping a message to a specific sequence of code (method) at runtime. ... C++ (pronounced see plus plus, IPA: /siː pləs pləs/) is a general-purpose computer programming language. ... Polymorphism also refers to polymorphic code, computer code that mutates for each new time it is executed. ...

 public void foo(List<String> l) { l.add("foo"); } 

Is l a LinkedList, an ArrayList, or some other subtype? The actual method referenced by add is not known until runtime. (Note that in the first example, the actual method is known.) ...


Since programs are often relocatable, every memory reference is ultimately a dynamic binding, since the segment is not known until runtime. This is a pedantic distinction, however, because binding operates at the programming-language level and not the machine level.


  Results from FactBites:
 
Type polymorphism - Wikipedia, the free encyclopedia (2962 words)
Polymorphism in the language ML and its close relatives is predicative.
In these languages, subtyping polymorphism (sometimes referred to as dynamic polymorphism or dynamic typing) allows a function to be written to take an object of a certain type T, but also work correctly if passed an object that belongs to a type S that is a subtype of T (according to the Liskov substitution principle).
Polymorphism in computer science can refer also to polymorphic code, that is code that mutates while keeping the original algorithm intact.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m