D vs. C#
Walter Bright
newshound1 at digitalmars.com
Mon Oct 22 15:53:33 PDT 2007
Robert Fraser wrote:
> Walter Bright Wrote:
>
>> 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.
>
> I'm not o sure about that. For example, I did some development for
> BlackBerry devices, which don't have a native code generator (or
> spec) available outside RIM. All external BlackBerry applications
> must be deployed in Java.
Why couldn't RIM provide a back end as easily as a Java VM? Like I said,
a simple back end could be as easy as:
push operand
push operand
call ADD
pop result
Notice how close that looks to java bytecode! But it'll still execute
much faster.
> This has the added advantage of security
> and reliability, since there's no way an errant application can break
> the entire device, and allows RIM to change the instruction set
> architecture at any time.
If the language has no pointers, and RIM provides the compiler for it,
that is just as secure.
> Of course, that distribute-binaries-as-source thing would work, too,
> but imagine sticking a whole lexer/parser/semantic/code generator on
> a mobile device... that processing power is better spent actually
> executing the application.
It's about 500K of rom needed. And the code will run several times
faster, even with a simplistic code generator, which will make up for it.
More information about the Digitalmars-d
mailing list