Dynamic Languages Shine in Silverlight

 
 
By Darryl K. Taft  |  Posted 2007-04-30
 
 
 

Dynamic Languages Shine in Silverlight


LAS VEGAS—A "very cool story" is among the many announcements Microsoft is making at its MIX 07 conference here.

The software giant announced its new Dynamic Language Runtime that enables dynamic languages to talk to each other and support for it on the Microsoft Silverlight platform. Microsoft is making the technology broadly available to the community via its permissive license and CodePlex community site.

"One of the things were doing with Silverlight is, beyond having it based on .Net, were going to be shipping support for dynamic languages inside the client-side runtime," said Brian Goldfarb, lead product manager of the Web Platform and Tools team at Microsoft. "So, basically bringing dynamic languages to the browser and doing that in a very easy-to-use way."

Moreover, "At the show were going to be shipping bits that let people use JavaScript and Python," Goldfarb said. "And were going to be demo-ing Ruby in the keynote working on top of Silverlight. Its a very, very cool story."

The story actually started nearly three years ago, when Microsoft hired Jim Hugunin in August of 2004. Hugunin, the creator of the IronPython implementation of Python for the .Net platform, is a development leader on Microsofts CLR (Common Language Runtime) team. "I joined Microsoft with IronPython, but I joined to make the CLR a better platform for dynamic languages," Hugunin said.

IronPython was the start of something big, in that it represented a quality production implementation of a language. "Now that we have that one quality implementation, we started saying, Well, how can we make more languages run well on the platform and make them run even better?" Hugunin said.

"So the idea of the DLR is to support a broad spectrum of languages building on what weve learned already, taking all the things in the CLR," Hugunin said. "IronPython runs well in the CLR because its got great things inside it, like really excellent GC [garbage collection], JITs [just-in-time compilation], excellent type system that you can work within, debugging, profiling, sandbox security model—great features that make it easy to build a language on top of it."

Click here to read a Q&A with Jim Hugunin and John Lam.

In an interview with eWEEK last August, Hugunin said that if Microsoft is able to learn from the process of implementing IronPython on the CLR then "Ruby becomes easy." Indeed, in that interview, Hugunin said, "As I think about where we go beyond IronPython, what we really want to do next is try to generalize what weve learned."

Meanwhile, to help make the process of integrating Ruby onto the Microsoft platform a little easier, Microsoft hired John Lam, a Ruby guru and creator of the RubyCLR .Net to Ruby interoperability bridge, last October. Lam said he has been bootstrapping the Ruby effort and has a solid demonstrable implementation.

However, despite being a technological coup in itself, what makes the DLR stand out in this instance is its integration with Silverlight. Silverlight is a cross-browser, cross-platform plug-in, akin to Adobe Systems Inc.s Flash, for delivering the next generation of media experiences and RIAs (Rich Internet Applications) for the Web.

Hugunin said he anticipates broad adoption for the DLR, particularly because of its connection with Silverlight. He said that at various events and conferences, he has seen the Python community get "excited" about things like WPF (Windows Presentation Foundation) rendering APIs, XNA Game Studio APIs or Microsoft Robotics Studio APIs. But Silverlight goes further, he said.

"They always get excited about heres this platform that you can build on top of," Hugunin said of the Python community. "I think the Silverlight platform goes far beyond any platform weve been able to give them before. Now you can write your Python code and you can run it in any browser anywhere with an amazing set of APIs behind you. The Silverlight rendering is just great fun to play with."

While playing around with the platform, Hugunin said he found it surprising "how much fun it was to write in a real programming language, with all the kinds of structures that I was used to having working against a powerful set of APIs and have it run in the browser."

That is because "In the past, Ive tried to write code in AJAX [Asynchronous JavaScript and XML] and Ive tried to write code in Flash," Hugunin said. "When I write code in both of those "languages" I find that theyre platforms. I find that Im writing the program in my head and then figuring out how to turn it into AJAX code. Nobody writes AJAX code directly. Everybody figures out what they want to do and then figures out how to turn that into AJAX code," he said. However, "people do write Python code directly all the time. And Silverlight was kind of a revolutionary thing for me in that I could just be writing Python code that just said what I wanted to say and it ran in the browser, because somebody else had built a complicated platform for me."

So, added Hugunin, "I think the ability to do this in the browser changes the game from what we can provide and what weve been providing before with IronPython, and then there are the other languages."

Lam agreed, adding: "I think the browser makes it very distinctive for people to build stuff on top of, which is something that you really cant find elsewhere. So to attract users to the platform were coming out of blocks with something that is really compelling."

Next Page: Talking Points

Talking Points


The initial implementation of the DLR supports four primary languages: IronPython, JavaScript, Ruby and Visual Basic. In addition, the DLR supports C# for adding performance boosts where necessary, Lam said.

"By having this shared type system and these dynamic languages using the same sets of types, you can go back and forth between them," Hugunin said. "In the long run, things like wiring up event handlers, every language is going to have. But every language is always going to have the things that it does better. And the really cool code that somebody went out and wrote in just one language…if they could all talk to each other, you just get a lot of power as a language developer."

Hugunin said the .Net platforms sandbox security model helps to secure the DLR. "The Python implementation that were shipping is completely security transparent. What that means is all the security is in the Silverlight engine; its in the .Net engine that were running on top of... That makes it possible for a lot more languages to start running in this kind of environment, because you can build on the .Net security model."

Meanwhile, performance, which is typically an issue with dynamic languages, is not a particular concern on the DLR, Hugunin said. "I would consider performance successful if we did nothing but matched the level of the existing languages, plus provided all of this infrastructure and integration that you have," he said. "Now I wouldnt be thrilled and jumping up and down if all that we did was matched it, but at a basic level what we need to do to succeed with performance is show that you can run these languages all on a shared engine without giving up any performance."

Lam spoke on the possible ramifications of the latest Microsoft moves. "I think whats really interesting about Silverlight is the fact that all this stuff, if youre building something in a dynamic language is just all text," he said. "And considering the way the Web was built using this kind of collaborative community knowledge of how to build stuff in HTML, JavaScript and CSS, much the same experience is going to happen in Silverlight, except were just going to replace some of the acronyms. Theres going to be some HTML still, but theres going to be XAML [Microsoft Extensible Application Markup Language] thrown into the mix, as well as the source code for a variety of different programming languages—be it JS [JavaScript], VB, Ruby or Python. But also the flexibility of, in certain circumstances, being able to throw some compiled C# code down there for performance reasons."

"A pluggable DLR will not only bring a whole new generation of language support to .Net, it will also spur a wealth of new research opportunities, in much the same way the original .Net Framework did when it was introduced five years ago," said Robert McLaws, president of Interscape Technologies Inc. in Phoenix.

"On top of that, if Microsoft announces anything about Ruby running on the DLR, and if it runs existing Ruby code without modification, then think how powerful it would be if you combined that with the IIS7 application platform," McLaws said. "Combine dynamic languages with everything else .Net 3.0 and 3.5 has to offer, and why would you want to develop on any other platform? And if Microsoft delivers official cross-platform support, as expected, then I think Microsoft will have a home run on its hands. It will definitely overshadow the whole open-sourced Flex thing, at any rate."

Microsoft is making the new technology broadly available to the community, the company said.

"Were shipping both IronPython and the DLR layer, which is a layer on top of the CLR," Hugunin said. "And were shipping both of those on CodePlex under the Microsoft Permissive License, which is the BSD-style [Berkeley Software Distribution] Microsoft license. And were doing that partially to invite people to play with it, give us a lot of feedback and go do interesting things with it. So its very much in the source-available, do-with-it-what-you-want-to spirit."

The Microsoft Permissive License allows for commercial modification and redistribution of source code with no royalties to Microsoft. The Microsoft Permissive License is most commonly used for developer tools, applications and components or for use with collaborative development projects where there are joint contributions from both Microsoft and external developers. Both the DLR and IronPython will be available on CodePlex, an online collaborative software development portal that is also a vehicle for sharing source code. Meanwhile, Hugunin said the DLR will be updated to support other languages, including quite possibly PowerShell, Microsofts shell scripting language.

"I know its an obvious question to ask what about PowerShell," Hugunin said. "PowerShell we explicitly didnt focus on deeply for this first round, and thats because this first round is focused on Silverlight. So were focused on the languages that youd want to able to run in the browser. PowerShell has a very different focus. PowerShell is a very rich client language running locally on the machine to do anything I want to on my machine, because its a shell scripting language."

At the MIX 07 event, Microsoft also is announcing the availability of the beta version of Microsoft Silverlight 1.0, to build media experiences and RIAs. And the Silverlight 1.0 beta features a go-live license, which means customers can deploy their Silverlight applications in production. Microsoft Silverlight 1.0 is scheduled to be available this summer.

In addition, Microsoft is announcing the availability of an alpha version of Silverlight 1.1, which features DLR support, as well as support for ASP.NET AJAX and LINQ, the Language Integrated Query technology.

Check out eWEEK.coms for the latest news, reviews and analysis in programming environments and developer tools.

Rocket Fuel