Why is "phobos" hardcoded in DMD
Justin C Calvarese
technocrat7 at gmail.com
Tue Apr 17 23:30:37 PDT 2007
Derek Parnell wrote:
> On Wed, 18 Apr 2007 07:31:32 +1000, Derek Parnell wrote:
>
>> Hi Walter,
>> what is the rationale for having "phobos" hardcoded in DMD?
>
> Maybe I haven't been clear enough. My question above is a sincere one and
> not rhetorical. I believe that it is possible that there is a very good
> reason for having Phobos hard coded, it's just that I don't know what that
> might be and I would like to find out.
Only Walter knows the answer to this, but I'll offer a guess.
I suspect the reason that it's hardcoded is because it'd be next to
impossible (if not impossible) to write a D program that doesn't require
something stored in phobos.lib. In particular, the garbage collector is
in there. The standard lib also contains the object prototype and the
code required to sort an array. Since you would need an object to work
with exceptions, the program that doesn't need something from the
standard lib is going to be very stripped down.
Of course, they've made Tango work without Phobos by studying which
parts of Phobos are required to be in the standard library by the
language and put something similar in Tango.
It would be nice if we could use some sort of command line line switch
to specify to use another lib than phobos.lib so that Tango and Phobos
could coexist more easily. Programs would still be unable to use Tango
and Phobos at the same time (at least until Gregor Richards released
"tangobos"), but a "alternative standard lib" switch could still come in
handy.
>> Would there be much work to free this up to make it a configuration item
>> instead?
>
> By "configuration item", I am not trying to imply any specific
> implementation. Rather I'm just expressing a desire that Walter allows
> something external to DMD, but controllable by the developer, to be used to
> inform the linker what should be the /default/ library to link against. I
> suppose if none is supplied by the developer to DMD that DMD could use
> "phobos" as its in-built default name.
I don't see why this wouldn't be possible. I'll bet that someone
familiar with the DMD front end could figure out how hard (hopefully
it'd be easy) this would be. (But looking at the DMD front end isn't one
of my talents.)
--
jcc7
More information about the Digitalmars-d-learn
mailing list