ASP.NET with IronPython, Silverlight DLR Console Prototype
Technorati Tags: .NET, Microsoft, Developer, DLR, Dynamic Language Runtime, IronRuby, IronPython, Silverlight, ASP.NET Futures
If you download the Silverlight 1.1 Alpha and look closely at the contents of C:\Program Files\Microsoft Silverlight you'll see a number interesting assemblies, IronPython*.dll and Microsoft.Scripting.dll being the ones that jumped out most at me. Why? Well, Microsoft.Scripting.dll is essentially the DLR or Dynamic Language Runtime - in otherwords, support for scripting languages in .NET, and IronPython.dll contains the implementation of the dynamic OO Python language, sitting on top of the DLR (check out Iron Python on CodePlex, I'm using v2.0 Alpha 3).
IronPython is well integrated with the .NET framework meaning that Python developers can interoperate with other .NET languages (statically typed .NET libraries for example) and tools - work within Visual Studio for example, getting Intellisense, debugging, etc.
A good showcase of this is creating an ASP.NET Website, using IronPython as shown below:
(Note: to do this you'll need to download the ASP.NET Futures - I'm using VS 2008 Beta 2 here, but that's not a pre-requisite).
The result is familiar, except that the code-behind file for Default.aspx is Default.aspx.py:
In other words, an IronPython code-behind file : note the syntax highlighting of the keywords def and pass.
Add a couple of controls from the Toolbox as normal, and you can implement the event handlers in IronPython (currently the event handlers must be bound manually, rather than via the properties window or by double-clicking).
Stick a breakpoint in your button event handler, hit F5 and bang, you're debugging an IronPython website within Visual Studio, as shown below:
And just for completeness, here's the message returned:
IronRuby is also in the pipeline, there's a pre-alpha available now.
In the meantime, if you want to play around with IronPython outside of ASP.NET it's pretty easy, if you use the Silverlight DLR Console Prototype. It's a little bit like XAMLPad but let's you play around with IronPython or JScript and Silverlight. Here's what it looks like (including errors due to my typing - it expects an American keyboard layout):
Comments
- Anonymous
August 14, 2007
The comment has been removed - Anonymous
August 14, 2007
The comment has been removed