D vs. C#

Walter Bright newshound1 at digitalmars.com
Mon Oct 22 11:34:49 PDT 2007


Roberto Mariottini wrote:
> Walter Bright wrote:
>> Javascript is distributed in source code, and executes on a variety of 
>> machines. A VM is not necessary to achieve portability to machines 
>> unknown. What is necessary is a portable language design.
> 
> Obviously, this is valid only if you want to distribute the sources, and 
> sometimes you can't (i.e. royalties, sublicensing and the like).

Distributing Java class files is not secure, as good decompilers exist 
for them. Might as well distribute source.

> We are still talking only of the implementation, not the language 
> itself. I consider the Javascript environment as a high level VM, and I 
> still think that a compiled Javascript would be unusable.

It's true that Javascript uses a VM, but it doesn't use a standardized 
VM for which one distributes precompiled binaries too. Javascript is 
always compiled/interpreted directly from source code, and source code 
is how its distributed.

> Even if technically the big difference between portable and non-portable 
> resides on the language and the standard libraries, I think that not 
> considering the hundreds of working VMs that exist today is 
> narrow-thinking.

Considering that a C compiler exists for a far broader range of devices 
than VMs do, all the motivation that is needed is the language needs to 
be a) popular or b) have huge resources from a company like Sun to 
finance development of all those VMs. Sun could just as easily have 
provided a generic back end & library.

> To force developers to distribute their sources excludes a big part of 
> the software world as it is today.

Not the Java world - decompilers are common and effective.

> Making D compilable for the Java VM today would make it immediately 
> portable to tens of platforms (and hundreds of cell phones models), today.

The Java VM is insufficiently powerful to use as a back end for D. It 
can't even do C.



More information about the Digitalmars-d mailing list