Summary
Mozilla announced at OSCON earlier this summer two new projects: IronMonkey and ScreamingMonkey, promising to bring languages other than JavaScript to the browser. In a recent blog post, John Resig describes what these projects mean, and why Mozilla didn't choose the Java VM for these projects.
Advertisement
When Adobe donated its Tamarin virtual machine to the Mozilla foundation, the company's director of engineering and Tamarin project lead Dan Smith told Artima that Tamarin was about:
Coming up with the absolute best implementation we can have. We expect other people to contribute to the [source code] base, and grow it to make it into the best engine... We've been working with Mozilla, along with Yahoo, Microsoft, and others, on the EcmaScript working group on the standard. It's a good idea for us now to work together with Mozilla on the implementation.
You will be able to run Ajax on top of this, and there will be a new language on top of it also that we refer to as JavaScript 2, which will be the EcmaScript 4-version of the [JavaScript] language.
Mozilla chose the Tamarin VM as the upcoming engine that will execute JavaScript inside Firefox and other Mozilla products. Adobe, in turn, is already using Tamarin as a key component of its Flash VM.
Now, two new Mozilla projects are about to deliver on the multi-language promise of the Tamarin VM, bringing with it the ability to write browser-based code in languages other than JavaScript. In his recent blog post, The Browser Scripting Revolution, John Resig noted that:
IronMonkey is setting out with the goal of mapping Microsoft's Common Intermediate Language (CIL) to ActionScript Byte Code (ABC), allowing additional language implementations, such as IronPython and IronRuby, to run in the Tamarin Virtual Machine.
IronPython and IronRuby are implementations of Python and Ruby, respectively, that runs on .NET Common Language Runtime (CLR) (and, incidentally, also on Mono), written in C#...
To break all of this down: There are implementations of Python and Ruby that are capable of being compiled down to a Common Intermediate Language, which will then be able to be run on Tamarin via IronMonkey...
This is a huge, huge, deal. This means that JavaScript will no longer be the only viable scripting language in browsers that use that Tamarin engine. At the very least, there'll be two more languages to work with. However, if IronMonkey works out well, I wouldn't be surprised if we see an implementation of PHP that runs in the browser...
ScreamingMonkey is the effort, being led by Mark Hammond, to allow the Tamarin engine to run within non-Mozilla browsers, starting with Internet Explorer.
In a follow-up to his post, Resig quotes Mozilla's Mike Shaver and Brendan Eich about why Mozilla chose Tamarin instead of the Java VM or the Mono VMs. About the Java VM, Eich noted that:
For Mozilla at least, we absolutely cannot depend on closed source, and we require a non-copyleft BSD license, or at most MPL/GPL/LGPL. Java was not even open source until recently (I don’t remember the date; it was preannounced one too many times :-/), well after we had to make our own plans and commitments.
Finally, in spite of the prospects with JRuby, the JVM really is about Java first and last. Tamarin is about an ECMAScript variant, so it’s a better target now, and more likely to evolve to support JS1 and JS2 in a first class way, than the JVM.
Compilation heroics can help, but the browser will remain an environment where compilation must be very fast. Wherefore our forthcoming work on a trace-based JIT.
What do you think of these projects and of the choice of the Tamarin VM?
In my opinion, a browser should be fast and lightweight. Adding too many features will turn it overweight. I think implementing plugins and extensions is a better solution.
While it would be nice to see Python in the Firefox browser, I would rather see CPython there, not IronPython. While it's pretty easy to rely on JavaScript being on every browser, the layer of dependencies needed to run IronPython (Tamarin[->ScreamingMonkey]->IronMonkey->IronPython) is pretty ridiculous. Are they relying on the user to install all these as needed, or will it be built into the Firefox install? If the user has to install it (which is almost certain because MS won't include it into IE), then it will have almost no penetration. If it's built into the Firefox install, why would the size of the distribution increase that much when you could simply distribute some CPython DLLs instead?
I really don't see where they are going with all this. It sure seems that the limited Mozilla resources would be better spent consolidating and improving their many technologies that already exist for rich clients (XUL, XBL, PyXPCOM, RDF, JavaScript, CSS, what have I forgotten) instead of adding yet more layers of crap.