Am 17.01.2009, 23:19 Uhr, schrieb Stewart Gordon <[email protected]>:
Trass3r wrote:
Are there any guidelines for writing code compilable with both dmd 1.x
and 2.x?
This is to make a library usable by users of either, I presume?
Yes.
- Have a module to define types for such things as pointers/arrays that
will be const in D2.
Yeah, using the following atm:
alias char[] string;
alias const(char)[] cstring;
alias invariant(char)[] istring;
- Use version(D_Version2) for bits of code that need to be different
between the two.
- Use string mixins to include D2 code that is syntactically illegal
under D1.
I'd like to use "alias char[] string", but dmd complains about conflicts
with the builtin "alias invariant(char)[] string"
Is there any way to redefine string in the scope of the library?
I know I could simply use another name or use char[] but if it's possible
to redefine it, I'd love to do that.