D vs. C#

David Brown dlang at davidb.org
Mon Oct 22 19:36:31 PDT 2007


On Mon, Oct 22, 2007 at 02:29:04AM -0700, Walter Bright wrote:

>>  d) For debugging purposes. Since p-code is interpreted, the interpreter 
>> can apply many additional runtime checks that are harder to implement with 
>> native code."
>
> That's a crock.

It's not that they're harder to implement, but who you trust to be
making the runtime tests.  For a VM, it can perform runtime tests, and
if you trust the VM, you can run untrusted programs and trust that
they won't do things (at least in the theory that your VM is perfect).
You can't do this is you're trusting that the checks were done by
whatever compiler compiled the program you're running.

Both .NET and Java do this.  They allow a kind of sandbox operation of
untrusted code.

It's almost impossible to do this with native code since most of the
type information is gone at that point.  While still in the VM,
pointer types can be tested and casts and such forbidden.

David



More information about the Digitalmars-d mailing list