D vs. C#

Dave Dave_member at pathlink.com
Sun Oct 21 21:21:37 PDT 2007


"Robert Fraser" <fraserofthenight at gmail.com> wrote in message 
news:ffh727$1trc$1 at digitalmars.com...
> Walter Bright Wrote:
>
>> Jussi Jumppanen wrote:
>> > I think Microsoft's longer term vision is to have .NET everywhere
>> > and I mean everywhere.
>>
>>
>> I've never been able to discover what the fundamental advantage of a VM 
>> is.
>
> I'm sure there are a lot of advantages, but here's one I can think of off 
> the top of my head: say you're designing an application for mobile 
> devices/smartphones. There are a lot of different phones out there, 
> probably all with different APIs (or no native API accessible outside the 
> company that made the phone), but if your software is running in a VM 
> it'll run the same everywhere. Now say you're a cell phone manufacturer 
> introducing a new smartphone -- adding the VM makes all the software 
> written to use that platform instantly compatible with your device.
>

Other than some runtime reflection that can be done with a VM (and not a 
static binary), I think the only concrete advantage is to compile one set of 
bytecode for all platforms instead of one binary for each platform. But then 
bytecode can be more easily "decompiled" and copied too.

Either way someone has to develop either a VM or a compiler for each 
platform. API's are really more a function of a library than a VM, IMO.

Runtime reflection aside, I can't think of anything a VM can do that a 
static compiler couldn't with the possible (but largely unproven) exception 
of sometimes generating better code because of access to runtime info. For 
example, static compilers / libraries can do most of that too if needed (and 
they can do it w/o the extra runtime overhead of profiling and re-compiling) 
by compiling some heuristics right in to the binary.




More information about the Digitalmars-d mailing list