DLR Hosting API : Dynamic Variable Lookup with Embedded IronPython
The IronPython (and Dynamic Language Runtime) hosting API has been designed from the beginning to make embedding IronPython into other applications easy. It has some interesting capabilities to this end.
One of the basic classes in the hosting API is the ScriptScope. These represent module namespaces, and where name lookups from inside the Python engine are done. As well as creating and manipulating standard namespaces, they can be created with a 'backing store' that allows you to customize name lookup.
The DLR Hosting API blog shows how to use this technique to chain scopes and create a 'pseudo heirarchy'.
The hosting API can be used from .NET languages like C# and VB.NET, but it can also be used from IronPython to customize code execution in a hosted engine.
One of the basic classes in the hosting API is the ScriptScope. These represent module namespaces, and where name lookups from inside the Python engine are done. As well as creating and manipulating standard namespaces, they can be created with a 'backing store' that allows you to customize name lookup.
The DLR Hosting API blog shows how to use this technique to chain scopes and create a 'pseudo heirarchy'.
The hosting API can be used from .NET languages like C# and VB.NET, but it can also be used from IronPython to customize code execution in a hosted engine.
Comments
Post a Comment