System - Dynamic: 1. What Is Dynamic Language Runtime (DLR) ?
System - Dynamic: 1. What Is Dynamic Language Runtime (DLR) ?
DLR is a runtime environment that allows you to integrate dynamic languages with the Common
Language Runtime (CLR) by adding a set of services, such as expression trees, call site caching,
and dynamic object interoperability to the CLR.
The System.Dynamic and System.Runtime.CompilerServices namespaces are used to hold
the classes for DLR. It also provides dynamic features to statically-typed languages, such as C#
and Visual Basic to enable their interoperation with dynamic languages.
2. What are the advantages of DLR?
The various advantages provided by DLR are:
Allows you to easily implement the dynamic languages to the .NET Framework.
Implements sharing of libraries and objects, which means that the objects and libraries
implemented in one language can be used by other languages using DLR. The DLR also
enables interoperation between statically-typed and dynamic languages.
Call Site Caching - Enables the DLR to store the information of the operations and
characteristics of the variables, such as their data type. The call site caching services also
enables to check whether such operations have been performed previously to retrieve all
the information about the variable. The place where DLR stores these values is called
a call site.
Dynamic Object Interoperability - Enables the DLR to provide a set of classes and
interfaces that represent dynamic objects and operations. These classes and interfaces can
be used to create classes for dynamic libraries, which can be used in static and dynamic
type languages.