fork download
  1. #!/usr/bin/rdmd
  2.  
  3. import std.stdio;
  4.  
  5. void main() {
  6. float[3] x = [1,1,1]; // ok
  7. float[] y = [5,5,5,5]; // ok
  8.  
  9. writeln(x[] + x[]); // error (Array operation v1[] + v1[] not implemented)
  10. float[] t1 = x[] + x[]; // ""
  11. float[] t2 = y[] + y[]; // ""
  12. auto t3 = x[] + x[]; // ""
  13.  
  14. float[] t1b = x[]; // ok
  15. t1b[] += x[]; // still ok
  16.  
  17. float[3] t2b = y[] + y[]; // ok??? how does this even... appears to give a float[3] array with values of a [0..3] slice of y[] + y[]...
  18. writeln(t2b);
  19.  
  20. auto t3b = x[]; // ok
  21. t3b[] += x[]; // still ok
  22. writeln(t3b);
  23.  
  24. x[] = x[] + 4; // ok
  25. writeln(x);
  26.  
  27. x[] = x[] + x[]; // ok
  28. writeln(x);
  29.  
  30. y[] = y[] + 4; // ok
  31. writeln(y);
  32.  
  33. y[] = y[] + y[]; // ok
  34. writeln(y);
  35.  
  36.  
  37. float t4[3];
  38. t4 = x[] + y[]; //ok
  39. writeln(t4);
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.d(9): Error: Array operation x[] + x[] not implemented
prog.d(10): Error: Array operation x[] + x[] not implemented
prog.d(11): Error: Array operation y[] + y[] not implemented
prog.d(12): Error: Array operation x[] + x[] not implemented
stdout
Standard output is empty