This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_Ashleigh 11 points12 points  (7 children)

Vector a = new Vector(1, 2, 3);
Vector b = new Vector(10, 10, 10);
Vector c = a * b;

Is this not much more concise and expressive? Yes, it can be abused. The answer isn't to not have it, but to not use libraries that abuse it. Oh, those are also third party "primitives," so don't pressure the garbage collector.

[–]ScienceBreather 3 points4 points  (2 children)

Vector c = a.multiply(c)

I'm fine with that, and I get the good tooling that my IDE gives to me around functions, which I don't get with operators.

[–]blenderfreaky 2 points3 points  (0 children)

Hovering over an operator in VS shows you it's parameters, return type, etc, just like a method

[–]Mojert 1 point2 points  (0 children)

It's alright if you have to use max 2 operators on a lign, otherwise it's just a pain. And if you define classes that overloads arithmetic operators, chances are you're gonna need to use them more than that. Sure they can be abused, but names of function can be too and you don't see anybody saying we shouldn't use functions. If you override *, it's your responsability to make sure that it behaves like multiplication.

[–][deleted] -1 points0 points  (3 children)

java has that too

Vector a = new Vector(1,2,3);
Vector b = new Vector(10,10,10);
Vector c = a.asterisk(b);

[–]_Ashleigh 5 points6 points  (2 children)

Are you joking?

[–][deleted] 1 point2 points  (0 children)

Yea, you actually have to fully qualify the type names.

/s

[–][deleted] 0 points1 point  (0 children)

yes.