C source in Phobos

Daniel Keep daniel.keep.lists at gmail.com
Sun Jun 11 23:39:17 PDT 2006


Hurm... odd.  I appear to have only "kinda-installed" DMC; I didn't like
how it wanted to organise the files, so I moved them around a bit.
That, and I didn't see any reason to have a fourth copy of the standard
C include headers :P

Funny thing is now I can't find the damn zip file.  Oh well, I'll get it
again.

As for the one language thing, I agree that Phobos should be in one
language... but I think we might be stuck with "errno.c": the *actual*
expanded definition of errno was completely incompatible between MSVC's
headers, Cygwin's headers and MinGW's headers.  Yet another reason to
detest the C preprocessor :P

Regarding Java, C#, etc... I suspect that parts of Java are written in
C/C++, since it doesn't have a way to directly call native code (which I
imagine it would need in places).  Also, don't forget that Java and C#
aren't self-hosting: their runtimes are written in native code for
performance reasons[1].  Yet another advantage we have over them ;)

	-- Daniel

[1] On the other hand, you should check out PyPy; it's Python
implemented in Python.  It's several orders of magnitude slower BUT it
has the interesting ability to output itself in other languages.  They
already have PyPy translating the Python interpreter from Python to C
and (I believe) one or two other languages.  Once in C, it's only a few
times slower :P

The cool thing with that is that it becomes easy to add weird new
features like transparent lazy evaluation, stackless support or a mark
and sweep GC; such changes would require large parts of the original C
interpreter to be rewritten.

James Dunne wrote:
> Daniel Keep wrote:
>> Hi.
>>
>> I've been looking into rebuilding Phobos (mainly to try adding some
>> things to the GC), and I noticed a few C files thrown around.
>>
>> Is there any reason why these files could not be rewritten in D?  I
>> imagine it would simplify rebuilding Phobos... I've already got three C
>> compilers on my system; I really don't want to have to add *another*
>> just to recompile one library :P
>>
>> Being able to do "build phobos" would be awesome :)
>>
>>     -- Daniel
>>
>> P.S.  Out of interest, has anyone else looked at adding weak references
>> to D's GC?
>>
> 
> If you downloaded the DMD package correctly then you *already have* DMC
> on your machine since DMD doesn't run without DMC's support package.
> 
> Also, I agree with your post and that Phobos should be a single-language
> library.  Java's standard library is written in Java, .NET's standard
> library is written in (I assume) C# (or at least all managed code),
> C++'s standard library is (again I assume) written in C++.
> 

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list