D vs. C#

Bruce Adams tortoise_74 at yeah.who.co.uk
Mon Oct 22 14:05:28 PDT 2007


Walter Bright Wrote:

> Bruce Adams wrote:
> > Imagine it as a compatibility layer or a shared library. If my OS
> > supports POSIX I can develop for POSIX. If I develop for windows as
> > well I have to learn and use other APIs. A VM is just a special kind
> > of API that provides a language backend and interpreter.
> 
> It can be thought of that way, it's just entirely unnecessary to achieve 
> those goals, and throws in a bunch of problems:
> 
> 1) perennial performance issues

The difference is what you are optimising the performance of. A dynamic language using a VM is optimising the programmers performance by allowing them to skip the compilation step at the expense of slower code.

> 2) incompatibility and inoperability with native languages

This is partly by design. A VM operating as a sandbox should not be able to go down to the hardware level.
However I think good interoperability has been demonstrated. Most scripting languages sport a way of writing extensions. These must be executed by the VM somehow. And then there's SWIG for automating the generation of wrappers.

> 3) gigantic runtimes needed

An interpreter itself is relatively small. I can only assume that a lot of the bloat is down to bad coding. If you look at games these days they weigh in at a ridiculous 4Gb install. No amount of uncompressed data for performance gain excuses that. I suspect its the same sloppy coding for VMs on a smaller scale. It would not surprise me to see much smaller (and more elegantly designed) run-times on devices such as PDAs where the bloat cannot be tolerated.

<asbestos suit>
I wonder if the compile time side of D might benefit from running inside a VM when people start to do really evil and complicated things with it.
</asbestos suit>




More information about the Digitalmars-d mailing list