On 10/17/13 22:03, Vitali wrote:
   // but what is the purpose of this?

auto arr1 = [1,2,3];
auto arr2 = arr1;
arr2.length--;
arr2 ~= 4;      // append 4

What do you expect arr1[2] is?


|
|
|
|
|
|
|
|
|
|
v

It's the original value 3! Which makes sense: why would the slice affect the original array? If that were the case you wouldn't be able to safely pass a slice of a big array to any function.


Reply via email to