27-02-2012, 03:22 PM
Dynamic language
introduction
Dynamic language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviours that other languages might perform during compilation, if at all. These behaviours 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 behaviours can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of them.
The Dynamic Language Runtime is built on the idea that it is possible to implement language specificities on top of a generic language-agnostic abstract syntax tree, whose nodes correspond to a specific functionality that is common to many dynamic languages.[13] This architecture is backed by the idea that the number of elementary language constructs that would have to be implemented on the generic stack should be inherently limited.[14] The DLR dynamically generates code corresponding to the functionality expressed by these nodes. The compiler for any dynamic language implemented on top of the DLR has to generate DLR abstract trees, and hand it over to the DLR libraries.
The DLR provides dynamically-updated Dynamic Site objects that cache the task of binding methods to objects. Since the type of an object—as well as the members it contains—in dynamic languages can change during a program lifetime, a method invocation must check the method list to see if the invocation is a valid one. Dynamic Site objects represent and cache the state of the object and its methods; any update to the object is reflected in the Dynamic Site objects as well. DLR routes all method invocations via the Dynamic Site objects, which then performs a fast lookup and binding of the method with the actual implementation.[15]