On Saturday, 7 June 2014 at 20:56:14 UTC, Paul wrote:
Dynamic array is really reference. Right? But why modification of parameter in this case does not work:

void some_func(string[] s) {
 s ~= "xxx"; s ~= "yyy";
}

but this works:

void some_fun(ref string[] s) {
 s ~= "xxx"; s ~= "yyy";
}

In the 1st case s is reference too, is not it?

It's a value type that holds a reference to data. If you modify the *actual* slice, rather than the referenced items, then you need to pass by ref.

Reply via email to