DMD 2.000 alpha release
Johan Granberg
lijat.meREM at OVEgmail.com
Mon Jun 18 11:26:09 PDT 2007
Walter Bright wrote:
> The current definition of string is:
>
> alias const(char)[] string;
>
> Andrei has argued strongly to make it invariant. I think he's probably
> right, and that change might happen next.
I don't think invariant here is such a great idea, consider the following
function.
void foo(string s){}
if string is const this can be called with both char[] and const(char)[] (if
not please correct me) but if my understanding is correct char[] would not
work if string is invariant. This will lead to an unessesary amount of
cast(invariant) when calling functions on local strings (as functions that
create strings will have to modify the when they are being built).
More information about the Digitalmars-d-announce
mailing list