Re:Why Zig over C for Systems Programming
by Ygg2 on Friday November 13, 2026 @11:26AM
(#50485838)
BS. Using operator overloading with SIMD makes it easier to translate algorithms into code. I wrote my own U8x32 wrappers and a + b is way better than a.add(b).
[ Parent
| on HN ]
I'm not disputing that some people like operator overloading, but clearly others prefer no overloading of any kind (don't know what the LLMs prefer, if they have any preferences). That's why we need options.
Re:Why Zig over C for Systems Programming
by clhodapp on Friday November 13, 2026 @12:32PM
(#50486790)
[delayed]
I'm not talking about custom operators. I'm talking about the ability for programs to overload either operators or other symbols (subroutine names). It's true that custom operators don't have to support overloads, but it's hard not to get collisions without overloads.
Re:Why Zig over C for Systems Programming
by cornstalks on Friday November 13, 2026 @12:00PM
(#50486336)
You can do a+b in Zig with SIMD vectors. No operator overloading required
Re:Why Zig over C for Systems Programming
by ogogmad on Friday November 13, 2026 @12:16PM
(#50486576)
Sure. But doesn't it still lack autodiff, quaternions, etc?
Re:Why Zig over C for Systems Programming
by cornstalks on Friday November 13, 2026 @01:46PM
(#50487934)
Yes, there are definitely other use cases that Zig doesn't support (which some may view as a good or bad thing). I just wanted to respond to the comment about basic SIMD since the example was U8x32 and operator+, which Zig can do.
Point wasn't about SIMD, but defining my wrapper for it and giving it operations I needed.
Which seems to be something Zig can't do.
Hell, you can define operators for generic length SIMD lane.
Same goes for any bitwise operation <<, >>, &, |, %.
Can I write my SIMD/number abstraction and have it work?
Let's say I need rotors. With six dimensions. Can I overload it's basic numeric operations?
Re:Why Zig over C for Systems Programming
by bunderbunder on Friday November 13, 2026 @12:22PM
(#50486653)
The example you choose is rather telling, though. It indicates that the use case you have in mind is not at all the one that Zig is targeting.
A more humble critique would be to just acknowledge that you don’t seem to be a member of Zig’s target audience, and move on.
I am in the target audience. I do want low level systems programming.
Saying "you don't want operator overloading" in such cases is a reductionist view of how systems programming should look.