4 ms·
Why would you need operator overloading in a low-level language? It's not like you are gonna write Jupyter notebooks with it. Zig is not meant to replace MATLAB
by johnnycerberus 6y ago
Why would you need operator overloading in a low-level language? It's not like you are gonna write Jupyter notebooks with it. Zig is not meant to replace MATLAB, Python or Julia. I would use it instead to build the backbone of such a data science platform.
- TinkersW 6y agoI use operator overloading in C++ all the time, you seem to be looking at it from a data science perspective, but other fields use math also, such as gamedev.
- johnnycerberus 6y agoI would have imagined that in game dev you prototype first with a high level language and then you would write the math code. How much of game dev is actually math code, aside from critical components like rendering, physics, etc.?
- TinkersW 6y agoNo that is not how it is done, the math is written directly in C++. If you have fast iterative build times, lots of assertions, and good debugger there is no reason to waste time writing it in another language first. Almost every system uses basic vectors and matrices/quats, most gameplay code also uses them etc.
- Qwertious 6y ago3D rotation is maths. How many 3D game objects don't rotate anything in gameplay?
- int_19h 6y agoConsider the fact that QuakeC had a native vector datatype back in the day, despite the fact that all rendering and physics was done in native C code.
- adwn 6y ago> Why would you need operator overloading in a low-level language? Have you ever heard of matrices and vectors? You need them in a lot of DSP (digital signal processing) applications, like audio and video filters, or in 3D graphics. Being able to write x = m * y instead of x = m.vector_mult(y) makes life so much more pleasant.
- johnnycerberus 6y agoIn Zig you write libraries that should be explicit and maintainable.
- adwn 6y agox = m * y is even more explicit than x = m.vector_mult(y) because the * operator is side-effect free by convention, while a method like vector_mult() might or might not be mutating (i.e., it could work like the *= assignment operator).
- andoriyu 6y agoHow is adding `Duration` to `DateTime` related to jupyter notebook? I use that much more often than element-wise matrix multiplication.