D1 -> D2

Walter Bright newshound2 at digitalmars.com
Thu Nov 18 11:39:31 PST 2010


Denis Koroskin wrote:
>  From my experience, a bigger issue is that
> 
> version (D2) {
>    /* some D2 only code involving const etc */
> }
> 
> simply won't compile in D1, because even if it's D2-only the code needs 
> to be correct D1 code as well.

I agree that's an issue. Currently, the only way to deal with this is one of:

1. Minimize the differences, and maintain two copies of the source code. Using 
the (rather fabulous) meld tool (available on Linux), the merging is pretty 
easy. I use meld all the time to, for example, merge differences in the code 
base between dmd1 and dmd2.

2. Isolate the code that is different into different files, which minimizes the 
work involved in (1).

3. Use string mixins and the token string literal form.


I've also found that using the string alias rather than char[] does account for 
an awful lot of the differences.


More information about the Digitalmars-d mailing list