Walter Bright schrieb:
As for the does one develop stable code targeting D1 and D2, I would suggest targeting D1 but be careful to use the string alias for all the char[]'s, and treat strings as if they were immutable. This will cover 90% of any source code changes between D1 and D2, perhaps even more than 90%. It's also very possible to write D1 code using the immutability style, in fact, I advocated it long before D2 (see all the old threads discussing Copy On Write).

Well, using the string alias leads to problems, esp. when used as a function parameter:
int func(string str)

This makes it impossible to pass a mutable string to the function in D2.

I personally use an alias const(char)[] cstring; for most of my parameters and alias invariant(char)[] istring; for normal immutable strings.

Reply via email to