Proposal : Operator overloading change from static method to instance method #3218
Replies: 5 comments
-
I do not like this syntax (I did not like it in C++, either), because one does not always know which instance is which (meaning, the left-sided or right-sided operand). I would rather see static methods/operators being supported by interfaces. This should be covered by the proposal #164. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@HaloFour Thank you for your information, I under stand what is their concern. var vec = Vector<double>(array);
var result = vector * 2.0; That why so many people prefer to develop numerical computing on python. There are some other patterns can fix this issue too. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I would much rather see the ability for overloads to be extension methods. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Now Operator overloading has pattern like this.
I recommend to change it to instance method like this
Because all operation overloading have first argument that act like instance method.
Benefit as I can think now:
Beta Was this translation helpful? Give feedback.
All reactions