Dynamic Languages in Silverlight 2 RC0
This release works with Silverlight 2 RC0. Keep in mind this is a developer release, so no "end-user" runtime exists. This is why the "not-installed" experience doesn't take you directly to the download, but to a page where you can install the tools.
This release has slightly refactored Microsoft.Scripting.Silverlight, adding two new types: "Package" and "Configuration". You can use "Package" to access files inside the XAP, and "Configuration" can be used to detect languages available in Silverlight.
In past releases, if you wanted to host the DLR you needed to create your own ScriptRuntimeSetup which uses Microsoft.Scripting.Silverlight.BrowserScriptHost to tell your hosted scripts about how Silverlight. Your code would look like this:
using Microsoft.Scripting.Silverlight; using Microsoft.Scripting.Hosting; //... var setup = new ScriptRuntimeSetup(); setup.HostType = typeof(BrowserScriptHost); var runtime = new ScriptRuntime(setup); //...
Now, since the ScriptRuntimeSetup we use to run user code is public, you can simply this code to:
using Microsoft.Scripting.Silverlight; using Microsoft.Scripting.Hosting; //... var runtime = DynamicApplication.Current.Runtime; // or if you wanted to create your own runtime, reuse the setup var runtime = new ScriptRuntime(DynamicApplication.Current.Runtime.Setup); //...
Blah, blah, blah, I always talk about the future. Has anything happened? Nope. Well, it will eventually. Just keep pestering. If you have no idea what I'm talking about, take a look at my last post.