www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why invariants in D 2.0 std.string?

I just grabbed the D 2.006 compiler, and there is a change from before that
I'm wondering why it was done.

In std.string, the functions previously worked with const(char)[]. Now, they
all work with invariant(char)[] instead, taking one in, and passing one back.

What is the reasoning behind that? Them promising not to change the string
makes sense, but requiring invariant doesn't seem quite right to me.

Adam D. Ruppe
Oct 30 2007