-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operator overloading for built in math types #21
Comments
Operator overloading used properly absolutely makes code more readable. Would you like to prevent someone coming along with a numpy or pandas or tensorflow with readable operators for V? You aren't going to build all that into the language. Something to consider. |
Operator overloading can be nice, but it's mostly syntactic sugar. It doesn't add much in the way of readability, and despite |
You could as well argue that primitives aren't used often anyway, so why have operators in the language at all? Still, any solution, including built-in vector types, could easily be added after 1.0. |
Oh absolutely, this is going to happen after the public release. |
In my opinion there's absolutely nothing wrong with allowing operator overloading. If people write messy code, they're going to write messy code; and limiting them won't help that. I've always found the debate about operator overloading absolutely confusing. Yes, people can use the |
I needed this today, so I just spent about 20 minutes to implement it: |
* Update winnt.h * Add files via upload * Add files via upload * Add files via upload * Update windef.h * Update kernel32.def
Operator overloading is bad. It makes code unpredictable.
Mike Acton says that it should only be allowed in very simple cases, like adding vectors. I agree.
I want to make V convenient for gamedev and scientific applications. They use a lot of linear algebra, and
res := a.add(b).add(c)
is a lot messier thanres := a + b + c
The only way to achieve this without introducing operator overloading for everything is to have official math types supported by the language (vec2, vec3, mat4 etc).
What do you think?
The text was updated successfully, but these errors were encountered: