Segregating the standard library

Daniel Keep daniel.keep.lists at gmail.com
Fri Nov 17 14:47:19 PST 2006


Something I've been thinking about.

Whilst I think D is making great progress to a fantastic 1.0 début, the
standard library is somewhat lacking.  Not to knock Walter's efforts in
the slightest, but D's standard library is somewhat lean compared to,
say, Python's standard library.  Let's not even try comparing it to
Java's (arguably the only reason Java even succeeded in the first place.)

As such, I think there's something we need to do before D 1.0: we need
to split the compiler and the standard library.  Specifically:

* We need to make a clear distinction between the absolute bare-minimum
for the compiler and produced programs to function (let's call that the
core lib) and everything else (the standard lib.)

  The core lib would probably contain things like intrinsics, and
anything else necessary (I think that also includes Object, but I'm not
sure *why*...)  The core lib would be compiler-specific, and maintained
under Walter's control.

* The standard library should be split off as a separate project under
community control, with Walter periodically taking stable snapshots to
bundle with the D compiler.

The reason for this is that I'm worried people will look at D 1.0 The
Language and say "great steaming gouts of magma on a beeline for the
orphanage; forget C!", but then look at D 1.0 The Standard Library and
say "well, that's somewhat of an anticlimax."

Doing this, we can say: "here is the shiny new D 1.0 compiler.  Yeah,
the standard library is a little on the skinny side, but it's being
actively worked on, and you can update any time you like."

A few more random thoughts on this:

* I know Walter has said before that if anyone wants to contribute to
Phobos, that he's more than happy to take patches.  The problem is that
the website doesn't say this, and it doesn't have that air of "all
welcome to join in" feel that, say, dsource projects do.  Having a
public svn server and development forums/mailing list dedicated to the
standard library would probably help.

* Do we use Ares?  I suppose that's up to Walter; his choices are to
either bless Ares as what he will be distributing as "standard" with D,
or have a separate Phobos project.

* Irrespective, I think it's important that we structure the split so
that projects like Ares can peacefully coexist with whatever Walter
decides to ship with D.

* As such, D really, *really* needs a switch that says "don't link the
standard library."  At the very minimum, we should be able to specify
which standard library to use on either the command-line, or a
configuration file.  Also keep in mind some crazy people who might need
to link against either depending on the project at hand :)

* The standard library should maintain both a "1.0" version and a
"current" version, using whatever 1.0 version identifier Walter has the
compiler emit.  This means people can continue upgrading the standard
library whilst using the same compiler, or upgrade the compiler and use
the same standard library (so long as they use 1.0 as the middle ground).

* Incidentally, this brings up an interesting problem: we can't select
which symbols to link based on version identifiers.  Perhaps future D
compilers should link dstdlib.lib by default, and d1_0stdlib.lib when
the -D1.0 switch is thrown...

* The GC should be considered part of the standard lib, not core.  The
reason is that there are several people over the years who have
expressed interest in replacing or modifying the garbage collector D
uses (myself included.)  Currently this is very difficult simply because
you also need to rebuild the rest of the standard library, and then
completely replace phobos.lib.

* Perhaps we should even go so far as to put the standard library and GC
into separate .lib files...

Thoughts?  If this is way off base and unnecessary, just say so; I just
thought I'd throw this out there :)

	-- Daniel

P.S.  I said earlier today that there should be a document outlining
string usage in D.  If no one else wants to do that, I have a few ideas,
but they'll have to wait a bit... driving test in an hour or so :P

-- 
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