The great compromise of the D standard library
Bill Baxter
dnewsgroup at billbaxter.com
Thu Oct 18 20:57:00 PDT 2007
Darryl B wrote:
> == Quote from Ender KaShae (astrothayne at gmail.com)'s article
>> I have great misgivings over the divide among the D community between standard
> libriraries. The contintion will no doubt eventually lead to a schism reduce the
> reusibility of D code.
>
> I absolutely agree with this point. One of the first eyebrow-raising experiences
> for me, moving to D, was learning of this 'alternate' standard library. The 'D'
> standard library should be 'the' D standard library, shouldn't it? You may as well
> be writing in a different language, going from one lib to the other. You really
> have to specify which 'flavor' of D you use when speaking to others, and a Tango
> dev may not even want to look at a problem someone has if they were using Phobos.
> The separation of the 'D-Tango' and 'D-Phobos' factions is detrimental to the D
> language as a whole, IMO.
There's also D2.0 which is a completely different, incompatible version
of D. So really there are *three* different incompatible versions of D
to choose from right now (yes you can get some source code to compile
with both D1 and D2, just like you can get some code to compile with
either Tango or Phobos).
I was all for adding of const to D, but my vision was for it to get
added relatively quickly and become the one-and-only D. Add it quickly,
get everyone to fix their code, and then forget there ever was a D
without const. Leave it in the dust. Just like we forgot about D with
regular expression literals, or D with the === operator.
But instead we got a D-without-const codified as a permanent, unchanging
standard and D-with-const as a new, incompatible, competing standard.
Taking a step back it just seems really silly for a niche language like
D to have so many factions.
So here's a little proposal to maybe help mend the D1/D2 schism a bit:
add -v2 compatiblity switch to D1 that would cause it to just ignore
D2's const and invariant declarations. That would make writing code
that works on both a lot easier.
After porting a bit of D2's std.* to D1, it seems that the main issues
are just const(foo)[] and invariant(foo)[] constructs here and there.
The fix is almost always just to remove them. So if the D1 compiler
could be made to ignore those then that would remove most of the hassle
of making code compatible between D1 and D2.
--bb
More information about the Digitalmars-d
mailing list