Navigation
  • Home
  • Recent
  • Most Active
  • Popular
  • Blog
  • Credits
  • RSS
  •   Interaction
  • Register
  • Statistics
  •   Help
  • Suggestions
  • Contact Us
  • How to Edit
  • Help



  • [Edit]


    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 which share many common runtime behaviors that other languages only perform during compilation, if at all. These may include extending the program during execution by adding new code, extending objects and definitions, and modifying the type system. These behaviors can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of them.

    Dynamic languages and dynamic typing are not identical concepts, and a dynamic language need not be dynamically typed, though many dynamic languages are dynamically typed.


        Dynamic programming language
            Limitations and ambiguity in the definition
            Implementation
                Eval
                Runtime alteration of object or type system
                Functional programming
                    Closures
                    Continuations
                Introspection
                Macros
            Languages
            See also

    top

    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.

    top

    Implementation
    There are several mechanisms closely associated with the concept of dynamic programming. None are essential to the classification of a language as dynamic, but most can be found in a wide variety of such languages.

    top

    Eval
    Eval is a term which was introduced in Lisp, and refers to the process of executing instructions which are represented by data structures called S-expressions. In its modern sense, eval or evalling refers to the mechanism or process of executing any sort of instructions that are available to the program as text or non-machine code data. The evaluation of new program text is a common aspect of many languages that, unlike Lisp, do not make a distinction between reading text and transforming it into an internal form and further transforming that internal form into actions to be taken. These languages are often called interpreted languages when the process of normal program execution is an eval.

    top

    Runtime alteration of object or type system
    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).

    top

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

    top

    Closures
    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:

    begin function newscanner (word)
    tmpfunction = begin function (input)
    scan_for_text(input, word)
    end function
    return tmpfunction
    end function newscanner

    Note that the inner function has no name, and is instead stored in the variable tmpfunction. Each time newscanner 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 are one of the core tools of functional programming, and many languages support at least this degree of functional programming.

    top

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

    top

    Introspection
    Introspection is common in many dynamic languages, and typically involves a program analyzing its own structure, code, types or data. This can be as simple as being able to determine the type of a generic or polymorphic value. It can also include full analysis of a program's code as data, such as the features that Lisp provides in analyzing S-expressions.

    top

    Macros
    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 macros 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 runtime, allowing the definition of language-like constructs which can optimize code or modify the syntax or grammar of the language.

    top

    Languages


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

    top

    See also



     
    Search more:
     

       
    Source Privacy License Download Contact Us Atlas
    Scientus.org Dictionary (Yet Another Wiki) RC : 1.39
    This article is licensed under the GNU Free Documentation License [copyleft]. It uses material from the Wikipedia article "Dynamic programming language". link