logoalt Hacker News

the__alchemistlast Sunday at 4:34 PM2 repliesview on HN

I wish Zig had lovely vector, quaternion, matrix etx syntax. The team's refusal to add operator overloading will prevent this.


Replies

flohofwoelast Sunday at 4:48 PM

You don't need operator overloading for vector and matrix math, see pretty much all GPU languages. What Zig is missing is a complete mapping of the Clang Extended Vector and Matrix extensions (instead of the quite limited `@Vector` type):

https://clang.llvm.org/docs/LanguageExtensions.html#vectors-...

https://clang.llvm.org/docs/LanguageExtensions.html#matrix-t...

renoxlast Sunday at 8:59 PM

Agreed, their reason for not allowing it is weird. No hidden overloading? OK make it explicit then: #+, #/ would be fine.

show 1 reply