Dynamic programming language

Dynamic programming language
This article is about a class of programming languages, for the method for reducing the runtime of algorithms, see Dynamic programming.

Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all. These behaviors could include extension of the program, by adding new code, by extending objects and definitions, or by modifying the type system, all during program execution. These behaviors can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of them.

Most dynamic languages are also dynamically typed, but not all are.


Limitations and ambiguity in the definition

The definition of a dynamic language is ambiguous because it attempts to make distinctions between code and data as well as between compilation and runtime which are not universal. Virtual machines, just-in-time compilation, and the ability of many programming languages on some systems to directly modify machine code make the distinction abstract. In general, the assertion that a language is dynamic is more an assertion about the ease of use of dynamic features than it is a clear statement of the capabilities of the language.


The following are generally considered dynamic languages:[1][2]



Some dynamic languages offer an eval function. This function takes a string parameter containing code in the language, and executes it. If this code stands for an expression, the resulting value is returned. However, Erik Meijer and Peter Drayton suggest that programmers "use eval as a poor man's substitute for higher-order functions."[5]

Object runtime alteration

A type or object system can typically be modified during runtime in a dynamic language. This can mean generating new objects from a runtime definition or based on mixins of existing types or objects. This can also refer to changing the inheritance or type tree, and thus altering the way that existing types behave (especially with respect to the invocation of methods).

Functional programming

Functional programming concepts are a feature of many dynamic languages, and also derive from Lisp.


One of the most widely used aspects of functional programming in dynamic languages is the closure, which allows creating a new instance of a function which retains access to the context in which it was created. A simple example of this is generating a function for scanning text for a word:

function new_scanner (word)
  temp_function = function (input)
    scan_for_text (input, word)
  end function
  return temp_function
end function

Note that the inner function has no name, and is instead stored in the variable temp_function. Each time new_scanner is executed, it will return a new function which remembers the value of the word parameter that was passed in when it was defined.

Closures[6] are one of the core tools of functional programming, and many languages support at least this degree of functional programming.


Another feature of some dynamic languages is the continuation. Continuations represent execution state that can be re-invoked. For example, a parser might return an intermediate result and a continuation that, when invoked, will continue to parse the input. Continuations interact in very complex ways with scoping, especially with respect to closures. For this reason, many dynamic languages do not provide continuations.


Reflection is common in many dynamic languages, and typically involves analysis of the types and metadata of generic or polymorphic data. It can, however, also include full evaluation and modification of a program's code as data, such as the features that Lisp provides in analyzing S-expressions.


A limited number of dynamic programming languages provide features which combine code introspection and eval in a feature called macros. Most programmers today who are aware of the term macro have encountered them in C or C++, where they are a static feature which are built in a small subset of the language, and are capable only of string substitutions on the text of the program. In dynamic languages, however, they provide access to the inner workings of the compiler, and full access to the interpreter, virtual machine, or runtime, allowing the definition of language-like constructs which can optimize code or modify the syntax or grammar of the language.

Assembly, C, C++, early Java, and FORTRAN do not generally fit into this category.

See also


  1. ^ http://www.eclipse.org/dltk/
  2. ^ http://www.activestate.com/manage
  3. ^ http://static.springsource.org/spring/docs/2.0.x/reference/dynamic-language.html
  4. ^ <http://groovy.codehaus.org/
  5. ^ Meijer, Erik and Peter Drayton (2005). "Static Typing Where Possible, Dynamic Typing When Needed: The End of the Cold War Between Programming Languages". Microsoft Corporation. http://citeseerx.ist.psu.edu/viewdoc/download?doi= 
  6. ^ See example of use on p.330 of Larry Wall's Programming Perl ISBN 0-596-00027-8

Further reading

Laurence Tratt, Dynamically Typed Languages, Advances in Computers, vol. 77, pages 149-184, July 2009

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Dynamic programming — For the programming paradigm, see Dynamic programming language. In mathematics and computer science, dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems. It is applicable to problems… …   Wikipedia

  • Programming language — lists Alphabetical Categorical Chronological Generational A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that… …   Wikipedia

  • Pike (programming language) — Pike Paradigm(s) multi paradigm: object oriented, functional, procedural Appeared in 1994 Designed by Fredrik Hübinette Devel …   Wikipedia

  • Algae (programming language) — Algae is an interpreted programming language for numerical analysis, a branch of mathematics. Its interactive interpreter is available under GPL. The language and its implementation were designed by Scott Hunziker and Mike Brennan starting in… …   Wikipedia

  • Concatenative programming language — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurr …   Wikipedia

  • D (programming language) — For other programming languages named D, see D (disambiguation)#Computing. D programming language Paradigm(s) multi paradigm: imperative, object oriented, functional, meta Appeared in 1999 (1999) Designed by …   Wikipedia

  • C (programming language) — C The C Programming Language[1] (aka K R ) is the seminal book on C …   Wikipedia

  • Lisp (programming language) — Infobox programming language name = Lisp paradigm = multi paradigm: functional, procedural, reflective generation = 3GL year = 1958 designer = John McCarthy developer = Steve Russell, Timothy P. Hart, and Mike Levin latest release version =… …   Wikipedia

  • Python (programming language) — infobox programming language name = Python paradigm = multi paradigm: object oriented, imperative, functional year = 1991 designer = Guido van Rossum developer = Python Software Foundation latest release version = 2.6 latest release date =… …   Wikipedia

  • APL (programming language) — APL Paradigm(s) array, functional, structured, modular Appeared in 1964 Designed by Kenneth E. Iverson Developer Kenneth E. Iverson …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”