REDMOND, Wash.—Sun Microsystems is planning to increase support for dynamic languages and is looking at various ways to better allow dynamically typed languages to run on the Java Virtual Machine.
Gilad Bracha, a computational theologist at Sun delivered a presentation called “Dynamically Typed Languages on the Java Platform” at the Lang.NET 2006 Symposium here on August 1, and said Sun plans to broaden its support for dynamic or scripting languages.
“It has come to our attention that some people want to program in things other than Java,” Bracha quipped.
Sun is broadening its support for dynamic languages to satisfy user demand, but also to help broaden the overall community of developers who use the Java platform, Bracha said.
Moreover, Bracha, who joked that “it is good to be behind former enemy lines,” noted that among the benefits of enhancing Suns support for dynamic languages is simplifying implementers lives.
He also said better support for dynamic languages also would likely yield more good implementations for programmers to use, and provide potential for “awesome performance over time.”
Meanwhile, Bracha noted that Sun currently offers support for some dynamic languages on the Java platform, such as Jython, Kawa, Groovy and ECMAScript.
And Java Standard Edition 6 (Java SE 6), also known by the codename Mustang, “will come with a JavaScript implementation packaged in” when it becomes available later this year, he said.
“Were solidly committed” to providing enhanced support for dynamic languages by adding a bytecode called Invokedynamic and adding hot swapping support, Bracha said.
Both of these efforts are part of JSR 292 (Java Specification Request 292), the goal of which is to allow scripting languages to be implemented natively on the JVM, he said.
As a start, Sun is focusing on method invocation, Bracha said. The JVM has four bytecodes for method invocation. One is invokevirtual, which is very close to the Java language semantics, but it is not enough, Bracha said.
“So we introduced invokedynamic; it is a loosely typed invokevirtual,” he said.
Invokedynamic is a possible solution to better enabling dynamic languages on the JVM because it “is a natural general purpose primitive. It is not tied to the semantics of a specific programming language, and it is a flexible building block for a variety of method invocation semantics,” Bracha said.
But this, too, is only a partial solution, he noted.
Meanwhile, “hot swapping,” which is the ability to modify code on the fly, is “one of the coolest things in programming,” according to Bracha.
Hot swapping originated with languages such as LISP, APL and Smalltalk, Bracha said. “It is common in scripting languages and its addictive. So it would be good to make some progress on this.”
“However, hot swapping is complicated and costly to implement, and typically leads to some sort of trade-off in terms of time or space,” Bracha said.
Moreover, Bracha said he could make no commitment whether JSR 292 would support hot swapping.
“Most likely we will enable hot swapping for the dynamically typed languages, but not for the statically typed ones,” he said.
Bracha said it is still too early to tell how it will all play out, but that “Sun wants to see a variety of languages running on the Java platform, particularly dynamically typed languages.”