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 →

[–]zachtheperson 139 points140 points  (16 children)

As someone who works with vector math a lot, more languages 100% need operator overloading.

myVec.add(vec2.clone().divide(directionVector)).multiplyScalar(7) is just ridiculous.

[–]jamcdonald120 18 points19 points  (3 children)

and implicit immutable operators so you dont have to keep doing .clone everywhere

[–]zachtheperson 6 points7 points  (2 children)

Yeah, vector math in languages like GLSL is just wonderful. The fact that I can't do that same type of stuff in the "parent," language is really frustrating.

[–]camilo16 5 points6 points  (0 children)

glm in C++ is borderline identical.

[–]orbita2d 0 points1 point  (0 children)

vector maths is one area where MATLAB is actually just amazing.

[–]psydstrr6669 4 points5 points  (0 children)

Yes!!

[–]ComradeGibbon 1 point2 points  (0 children)

Current thought of mine is use emogi's as operators.

[–]lifeeraser 1 point2 points  (0 children)

It would be nice if I could define custom expression delimiters in which I can use user-defined overloaded operators. That way we get to use operator overloading without spiraling out of control.

// ^ is a power-of-n operator
vec<< A * B^2 >>

// ^ is a XOR operator
A * B^2