Re: Surprise with array idup method

2012-08-23 Thread Philip Daniels
On Thursday, 23 August 2012 at 22:03:04 UTC, Jonathan M Davis wrote: On Thursday, August 23, 2012 23:55:10 Philip Daniels wrote: auto x = [1,2,3]; auto y = x.idup; y ~= 99; // fine! y[0] = 99; // "Error: y[0] isn't mutable" y.clear; // fine! So idup is returning an "immutable(int)[]" rather th

Re: Surprise with array idup method

2012-08-23 Thread Jonathan M Davis
On Thursday, August 23, 2012 23:55:10 Philip Daniels wrote: > auto x = [1,2,3]; > auto y = x.idup; > y ~= 99; // fine! > y[0] = 99; // "Error: y[0] isn't mutable" > y.clear; // fine! > > > So idup is returning an "immutable(int)[]" rather than an > "immutable int[]". > > I find this a bit surpri

Surprise with array idup method

2012-08-23 Thread Philip Daniels
auto x = [1,2,3]; auto y = x.idup; y ~= 99; // fine! y[0] = 99; // "Error: y[0] isn't mutable" y.clear; // fine! So idup is returning an "immutable(int)[]" rather than an "immutable int[]". I find this a bit surprising. Anybody else?