Hacker News new | ask | show | jobs
by banachtarski 2390 days ago
Zig is, however, unsuitable for interactive media or scientific computing due to the unfortunate lack of operator overloading (which is touted as a "feature"), rendering it less general purpose than I'd like.

Other aspects of its design look good however.

3 comments

Im not super sure what specific use case you are after but are you sure you can't do this in some ways with comptime generics? I have to be able to do most generic-like stuff with comptime (though I sometimes have to change the implementation a bit). I also really value how clear the lack of overloading makes the language. This way of clearly being able to follow the control flow is one of the things I like that they kept from C.
Yes I've tried zig a fair bit and the lack of operator overloading made the use untenable. The "ability to follow control flow" is, IMO, a silly argument. I will concede that `comptime` is a nice feature.
It is obvious how operator overloading makes scientific computing easier but what about interactive media? Can you clarify?
Oh so like, dual quaternion skinning, spherical quanternion interpolation, matrix multiplication, vector sums, etc.

I use a ton of linear algebra, vector algebra, and grassmann/clifford algebra at work and not having operators is like... why would I ever do that to myself. You end up in "parentheses" hell for things that would actually be nicely coded in concise and easy-to-understand expressions.

You can use syntax of the form vec1.add(vec2), which is still better than add(vec1, vec2)