D1 -> D2

Anders F Björklund afb at algonet.se
Thu Nov 18 04:02:34 PST 2010


Mike Parker wrote:
> On 11/18/2010 7:51 PM, Fawzi Mohamed wrote:

>> In the short term I don't think that going D2 only is really an option
>> for me, so how feasible it is to keep the code base compatible to both
>> D1 and D2?
>>
>> I know that one can define some templates (for example Const(T),....),
>> and maybe use mixins, but how much uglier does the code become as result?
>> I choose D to have cleaner code, I am not interested in loosing all that
>> just to be D1 and D2, then I prefer to wait, and convert everything at
>> once.

> In maintaining Derelict, which is nothing more than a simple collection
> of bindings to C libraries, I have had headaches keeping compatibility
> between D1/D2. It's nothing that has been difficult to solve, just ugly.
>
> If something as simple as a C-binding is uglified, I cringe at the
> thought of maintaining something more complex. It's going to get very
> ugly, very quickly. My attitude is that any future D projects I make
> available will be D2 only. I just don't think it's worth being
> compatible with both versions from a code maintenance perspective.

wxD had the same experience, with supporting Phobos/Tango and D1/D2.
It's "possible", but leads to ugly/duplicated code and best avoided...

For a C/C++-binding it's doable with liberal amounts of version(Tango)
and version(D_Version2) but that quickly gets hideous and in the way.

--anders

PS. Adding three compilers and three build systems, it just exploded.
     It made even the two OS and the three UI look simple in comparison.

     OS: Windows, Unix (linux, darwin)
     UI: __WXMSW__, __WXGTK__, __WXMAC__


More information about the Digitalmars-d mailing list