Uncategorized —

.NET and Java to get better dynamic language support

With highly expressive syntax that is easy to read, write, and maintain, dynamic programming languages like Python and Ruby are extremely conducive to rapid development. Microsoft and Sun Microsystems have observed growing interest in dynamic programming, and plan to integrate more extensive support for dynamic language features in their respective managed language platforms.

Microsoft developer Jim Hugunin reveals that the Redmond, WA software company is in the process of augmenting its popular .NET platform to simplify development of dynamic programming languages. Hugunin, the developer of a Python implementation for .NET called IronPython, says that the .NET Common Language Runtime will be extended in order to add additional support for dynamic language features. New libraries will be added as well to provide framework components that can be used by language creators. Microsoft hopes that the new features and the availability of the IronPython source code (which will act as a reference implementation) will encourage developers to bring other popular dynamic languages to the .NET platform. Several useful dynamic language features have already been added to .NET 2.0, most notably Lightweight Code Generation and DynamicMethod.

Hugunin is also very enthusiastic about the opportunities created by PowerShell, Microsoft's next-generation command line architecture. Built on .NET technology, PowerShell provides a highly sophisticated dynamic language that includes impressive support for first-class functions and other desirable features. PowerShell also comes with a broad selection of useful libraries and utilities that simplify common computing tasks. Hugunin hopes to expose much of that functionality to Visual Basic and IronPython in order to provide users with a broader selection of options for scripting.

In my overview of PowerShell (then called the Microsoft Command Shell), I pointed out that lack of support for defining classes in scripts represents one of the most significant limitations of the language. By enabling users to leverage the power and functionality of the PowerShell libraries and classes in an elegant and sophisticated dynamic language like Python, Microsoft can provide developers with the best of both worlds.

Python isn't the only dynamic language making its way to .NET. Canadian developer John Lam is currently developing RubyCLR, a bridge that will make it possible for developers to create .NET applications with Ruby. Other dynamic languages ported to .NET include Lisp (Rob Blackwell's L#), and Smalltalk (SmallScript Corp's S#).

Sun Microsystems plans to expand its own Java platform to provide stronger support for dynamic languages. In an uncharacteristically perceptive statement from Sun, Sun Computational Theologist Gilad Bracha admits, "It has come to our attention that some people want to program in things other than Java."

Sun has been steadily laboring to improve dynamic language support, and plans to include a JavaScript implementation in version six of Java Standard Edition. In order to simplify development of dynamic languages for the Java Virtual Machine, Sun has issued a Java Specification Request describing a new bytecode operation called invokedynamic, which Bracha describes as "a loosely-typed invokevirtual." Sun also plans to add support for dynamic metaprogramming facilities (runtime code generation mechanisms analogous to macros in Lisp and metaclasses in Python). Although several dynamic languages are already available for the Java Virtual Machine, including JRuby and Jython, the new features are important because they will simplify the language development process and expand the scope of functionality accessible to those dynamic languages. Dynamic metaprogramming is a particularly exciting feature that has a lot to offer in the field of domain-specific language design.

Many dynamic language enthusiasts are also interested in Parrot, an open source virtual machine designed specifically for dynamic languages. Initially conceived as the foundation for Perl 6, Parrot provides some extremely impressive features including a built-in grammar engine that vastly simplifies the process of language development. Although Parrot is far from complete, a number of languages built on top of it are at various stages of completion, including ports of Python, Ruby, Tcl, Lisp, and basic. Perl 6 developers claim that Parrot will eventually provide better performance than the JVM or .NET for dynamic scripting languages, but performance claims are currently debatable since Parrot is still in early stages of development. There are several significant architectural differences between Parrot and other prominent virtual machines, particularly the fact that Parrot is register-based, whereas Java's bytecode and .NET's Common Intermediate Language are stack-based.

Released yesterday, Parrot 0.4.6 includes new partial Ruby and Javascript implementations, improvements for the grammar engine and abstract syntax tree generator, and new opcodes for accessing globals, as well as numerous bug fixes and improvements.

Managed language platforms have a lot to offer modern dynamic languages, particularly performance (IronPython is one and a half times faster than the standard Python implementation in some contexts), interoperability, and broader library support. As dynamic languages continue to grow in popularity, widely used development platforms like .NET and Java will expand to meet that demand, and Microsoft and Sun will continue to strengthen their commitments to the dynamic language community. Parrot will also eventually catch up and provide a robust, open source alternative.