D, Java? To D or not to D?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Fri Jan 5 21:06:55 PST 2007


Sean Kelly wrote:
> Frits van Bommel 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.
>>
>> How would you implement a garbage collector in an 
>> architecture-independent way?
> 
> I don't think you would.  Rather, I think you'd have a separate runtime 
> library for each platform that handled all the necessary back-end tasks, 
> but which then called through to the same user-level D program.  This 
> would allow you to deal with platform-specific startup requirements, 
> memory allocation scheme, executable file layout, etc.  So long as the 
> ABI or whatever were sufficiently strict regarding how exception 
> handling occurs and a few other details, I think the compiled user code 
> would be portable across OSes.  But I'm not sure how this would interact 
> with things like calling C libraries built by other compilers.  For 
> example, DMD/Linux appears to pad doubles differently than DMD/Win32, so 
> how would the D user code know what to do re: pushing the values onto 
> the stack?
> 
> 
> Sean

Or in other words, a D-"unique" stub exe format, and a dynamicly linked runtime library... 
  probably ran via a loader program.  Huh, its a bit like a JVM.  ;)  Although so long as 
it targeted a particular cpu (x86, PPC, blah) it wouldn't be using bytecodes.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list