The need for a universal Virtual Machine

Lately I have been working on software, a lot, from low level embedded Linux stuff to ruby on rails applications. One idea that keeps coming back to me is how great it would be if there was a standard open source virtual machine platform on which to do (almost) all development on. Not just on the internet, or the desktop or mobile, but everywhere. I could choose my language of choice, instead of being stuck with say javascript in the browser or java on android or objective C on iOS. Each language would be treated equally, not an afterthought hacked in with reduced functionality. Applications could be written to work both online and off and the interface would look identical everywhere.

A VM that I have been watching closely lately is Parrot VM with the goal to run all languages. Under the hood, you can write libraries in an intermediate language that are then easily exposed to languages implemented on top of it. While exciting, development is slow, and my favorite language ruby, currently has only an unusable implementation. I keep imagining how cool it could be if this VM had every language you can imagine available and it was available in the browser, my computer and my phone. Also, how great it would be if every library was available for it, and therefor also available to every language on top of it.

I know there are many existing VMs, like the JVM, CLR and others, but almost all have been fatally flawed, often not by technical reasons but for political ones. I think the idea of a virtual machine not controlled by corporations, but by open standards, that could run everywhere is very powerful. It would make it much easier for new vendors to enter the mobile market, since all you really need to do is get the VM running on your hardware. It would ease compatibility and lock in issues, reduce how much code has to be written to support multiple platforms and give developers the flexibility they want.

I think there are many developers today who are held back by a lack of flexibility, not being able to use their language of choice at different layers of the stack. While its certainly true that some languages are better than others for certain tasks, I don’t think that judgement should be forced upon us.

Installing applications would be as easy as requesting a URI, there would be no cross platform issues, compiler issues, porting, and updating your app or your OS would be simple. Obviously there would be many objections to this idea, many may cite performance issues, but considering 90+% of what most people do today is in the browser, I don’t think this is great argument. Also, modern VMs can approach the performance of native code. Also, parsing HTML + JS is slow compared to reading in bytecode. Finally, the problems it would solve I believe would be immense and well worth the performance hit for most tasks.

Here are some ways I imagine it could be used:

Browser: The browser could either work as it does today, but new standards could require support for the universal VM. OR a new type of browser could be built around the concept. Users would then download bytecode files directly instead of html + script files. Compatibility modules could be created so that existing HTML + JS websites could be converted into bytecode and run in the VM Browser using HTML & JS languages on top of the VM. This would allow for easy support for existing websites, while allowing incremental migration and still supporting old browsers.

Desktop: A linux kernel with a thin hardware abstraction layer. Above that, the VM runs the show, with all software running in the VM. Imagine how cool it would be if all aspects of your system were available from libraries in every language. This would basically be just Linux with a browser running on top and there would be no distinction between web and local applications.

Mobile: Pretty much the same as the desktop.

 

In summary, what I am imaging is a sort of unified web and OS, where everything is run in a VM and most all languages are available and on an equal footing. I have many more ideas why this would be awesome as well as more potential criticisms, but I could not list them all!