I tested this code:
import std.stdio;
void main(){
double[] a=[1,2];
double[10] c;
c[]=a[]+0.;
writeln(c);
double[] b=[1,2,3,4,5,6,7,8,9,10];
double[10] d;
double[] e=b[0..2];
d[]=e[]+0.;
writeln(e);
writeln(d);
d[]=e[];
}
with the following result:
[1, 2, 0, 1.28823e-231, 1.11255e-308, -1.43745e+306, 0,
1.28823e-231, 1.56648e-307, 0]
[1, 2]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
object.Exception@src\rt\arraycat.d(31): lengths don't match for
array copy
----------------
415330
4151BB
406DC4
406DFE
406A1F
41C425
----------------
Unless I have missed something, it seems that:
= tests the length of the array and implies an exception
BUT:
+ does not test the length, and it is thus possible to read
information which are not allowed...
For information, I was testing how []+ were handling smaller
array (e.g. Error? completed with nan? completed with 0.? cyclic
computation?)