Thursday, May 01, 2008

Virtual Machines

In the recent debate about weather or not languages should ship with there own virtual machines, or use an established one. I'm with diversity here. Put simply different languages have different needs. Just because the JVM is good for java it doesn't follow that it will be good for Erlang. And Erlang is sufficently different to warrant it's own vm.

  1. An Erlang vm can assume that memory will not be modified. I expect his has a big impact on how you manage memory
  2. An Erlang vm requires tail recursion optimization. if you don't have this your code will be slow and use up more stack space.
  3. Every Erlang process has a message queue. Most VM's will not provide a message queue out of the box.
A lot of the same things also apply to Haskell, you can't expect a functional language to work optimally on a vm designed for procedural languages. the code optimizations and memory management strategy needed is radically different. In this I'm quite in agreement with the following post:

Making it stick.: Huh?: "The fact that it runs on its own interpreter, bad."

No comments: