D, Java? To D or not to D?
Don Clugston
dac at nospam.com.au
Wed Jan 10 07:34:45 PST 2007
Georg Wrede wrote:
> Walter Bright wrote:
>> TPJ wrote:
>>
>>> 1) In order to run a program written in D I have to compile it on the
>>> target OS.
>>
>> I haven't talked about this much, but it is technically feasible to
>> create a D runtime that enables "compile once, run everywhere". It is
>> not necessary to have a VM to do it.
>
> 1. To run on any OS on one specific processor, either those OSes have to
> have different entry points to the "exe", or there has to be a way of
> probing the OS within "common" code, the result of which would cause a
> jump to an OS specific routine.
>
> 2. To run on different processor architectures, (most probably with some
> of the same OSes), the worst case scenario would be that the same OS
> with the same jump target gets invocated on a different processor. This
> would mean that one (er, Walter) would have to invent a series of binary
> instructions that would not cause an (unwanted) exception on any of the
> processors, would not have any harmful side effects, and would
> eventually result in a jump to some processor specific version of the code.
> At first sight ("hearing" ?), it sounds too good to be true. Then one
> starts to suspect that either Walter has figured out a runtime gimmick
> that does it (thus rendering this (btw, patentable idea) independent of
> D), or it is some kind of result of the specific way D and its source
> code (more to the point, syntax domain) relate to the semantics of the
> source code, taken as a whole.
I've come up with one vague idea about how this could be done (which
doesn't involve either 1 or 2), though it would involve an obscene hack,
telling some serious lies to the OS. I can't think of a way it could be
done for OSes with radically different file formats, though.
More information about the Digitalmars-d
mailing list