Phobos and older DMD versions

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Aug 6 10:03:13 PDT 2013


On Tue, Aug 06, 2013 at 04:51:33PM +0200, qznc wrote:
> My recent pull request [0] triggered some issue, which should get a
> bigger discussion:
> 
> Should Phobos version N also compile with DMD N-1?
> 
> In my opinion it should, because it makes Phobos development
> simpler. You don't need a self compiled dmd to fix bugs.
> 
> However, reality sometimes requires exceptions. I understand that
> sometimes Phobos uses a feature of dmd HEAD. That is why I said
> "should", but not "must". ;)
[...]

The problem is that D is still undergoing rapid development, and often
new Phobos additions require the latest compiler features / bugfixes.
Jonathan pointed out the use of package.d to help break std.datetime
into more manageable pieces. That's an example of a change that couldn't
possibly compile with an earlier version of DMD.

Other examples include compiler bugfixes that require corresponding
changes in druntime/phobos. It's not possible to isolate Phobos from DMD
git HEAD in this case, since the changes must be applied to both,
otherwise it would result in Phobos being uncompilable / horribly
broken.

There *are* ways of working around this, of course. We could use static
if (__VERSION__ < 2064L) to keep Phobos compilable with dmd 2.063, for
example. But it would result in basically maintaining two versions of
Phobos within the same code, which deteriorates into the equivalent of
C/C++ #ifdef hell pretty quickly.


T

-- 
Life is unfair. Ask too much from it, and it may decide you don't deserve what you have now either.


More information about the Digitalmars-d mailing list