D vs. C#

Vladimir Panteleev thecybershadow at gmail.com
Mon Oct 22 11:58:48 PDT 2007


On Mon, 22 Oct 2007 05:19:39 +0300, Walter Bright <newshound1 at digitalmars.com> wrote:

> I've never been able to discover what the fundamental advantage of a VM is.

Some of the things which are only possible, or a good deal easier to use/implement with VMs:

1) code generation - used very seldomly, it might be used for runtime-specified cases where top performance is required (e.g. genetic programming?)

2) VMs make modularity much easier in that you don't have to recompile all modules ("plugins") on all platforms, which is often not possible with projects whose core supports many platforms, but most developers don't have access to all supported platforms.

3) very flexible reflection - like being able to derive from classes in other modules. Though this can be done in native languages by including enough metadata, most compiled languages don't. 

4) compilation is not a simple process for most computer users out there. If you want to provide a simple, cross-platform end-user application, it's much easier to use a VM - the VM vendor has taken care of porting the VM to all those platforms, and you don't need to bother maintaining source code portability, make/autoconf/etc. files, and compilation instructions (dependencies, etc.)
(ok, most computer users out there use Windows, and many non-Windows users know how to compile a program, but the point stands :P)

5) it's much easier to provide security/isolation for VM languages. Although native code isolation can be done using hardware, it's complicated and inefficient. This allows VM languages to be safely embedded in places such as web pages (Flash for ActionScript, applets for Java, Silverlight for .NET).

-- 
Best regards,
  Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list