operator overload with assigment?
hello, have you support operator overload with assigment?
@acterhd the operator overloading rewrites x += y as x = x + y automatically. Overriding + should be enough to implement both + and +=.
I suggest two unary operators: "&" and "|", that for SIMD means "allTrue" and "anyTrue".
I thought & and | were bitwise AND and bitwise OR. Are you suggesting that defining & should automatically define &= as x = x & y?
I've personally think that the best option override operator considers the three-operand. And the first operand, where he also gets the result (at least temporarily) does not mean assigment.
overload("+", [OutClass, InClassL, inClassR], function(where, left, right){
if(where == null) {
where = new OutClass();
}
left.addAs(where, right);
return where;
});
I think this approach is more natural to the assembly point of view.
overload("++", [OutClass, InClassL], function(where/*, left*/){
let clone = where.clone();
where.some++;
return clone;
});
And for example a += b, means that assigned to a, and returned a.
Isn't OutClass === InClassL always? Am I missing something?