D - operator+ and arrays
- Ben Hinkle (8/8) Jan 27 2004 In the doc for the + operator it says:
- Walter (5/13) Jan 27 2004 value
- Ben Hinkle (8/26) Jan 28 2004 the
In the doc for the + operator it says: "For the + operator, if both operands are arrays of a compatible type, the resulting type is an array of that compatible type, and the resulting value is the concatenation of the two arrays." Why support this when there is the ~ operator? I would expect array + to try to add element-wise - as should all artithmetic operations. Or it should error. -Ben
Jan 27 2004
"Ben Hinkle" <bhinkle4 juno.com> wrote in message news:bv5plg$1s6a$1 digitaldaemon.com...In the doc for the + operator it says: "For the + operator, if both operands are arrays of a compatible type, the resulting type is an array of that compatible type, and the resultingvalueis the concatenation of the two arrays."The doc is wrong. I'll fix it.Why support this when there is the ~ operator? I would expect array + totryto add element-wise - as should all artithmetic operations. Or it should error. -Ben
Jan 27 2004
"Walter" <walter digitalmars.com> wrote in message news:bv7jl6$1u97$2 digitaldaemon.com..."Ben Hinkle" <bhinkle4 juno.com> wrote in message news:bv5plg$1s6a$1 digitaldaemon.com...theIn the doc for the + operator it says: "For the + operator, if both operands are arrays of a compatible type,OK. I just tried it and it errors. Adding vectorized arithmentic ala Fortran, S or MATLAB would, I think, be really great but I can see how it could wait. The biggest problem with vectorized math in C/C++ is the memory management since the result array is implicitly allocated - but that is a non-issue with GC.resulting type is an array of that compatible type, and the resultingvalueis the concatenation of the two arrays."The doc is wrong. I'll fix it.Why support this when there is the ~ operator? I would expect array + totryto add element-wise - as should all artithmetic operations. Or it should error. -Ben
Jan 28 2004