Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by _hzrk on Wednesday March 31, 2021 @01:46PM
(#26650472)
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.
[ Parent
| on HN ]
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by adwn on Wednesday March 31, 2021 @01:58PM
(#26650653)
> 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.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by johnnycerberus on Wednesday March 31, 2021 @02:01PM
(#26650712)
In Zig you write libraries that should be explicit and maintainable.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by adwn on Wednesday March 31, 2021 @02:47PM
(#26651343)
x = 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).
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by TinkersW on Wednesday March 31, 2021 @01:53PM
(#26650589)
I 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.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by johnnycerberus on Wednesday March 31, 2021 @02:00PM
(#26650692)
I 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.?
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by TinkersW on Wednesday March 31, 2021 @02:21PM
(#26650979)
No 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.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri...
by int_19h on Wednesday March 31, 2021 @08:08PM
(#26654986)
Consider 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.