Why not alias string so that one can easily switch from the old string or wstring, etc?

e.g., rename string internally to sstring or whatever.

then globally define

alias string = sstring;

Which can be over realiased to wstring to affect the whole program

alias string = wstring;

Or use a command line to set it or whatever makes you happy.

I'm in the progress of converting a large source code database to use the above technique so we can move to using wstring... it is not fun. Most code that works with a string should with any string encoding, so it shouldn't matter. Making D string agnostic(after all, the only main different in 99% of programs is the space they take up).

If you are worried about it causing subtle bugs, then don't... because those same bugs would occur if one manually had to switch.

By designing techniques to use strings that are agnostic of there internal representation should save a lot of headache. For those few cases that it matters, simple static analysis works fine.






Reply via email to