4 ms·
i feel like i'd want operator overloading when dealing with quaternions, which zig eschews for no good reason
by baazaa 2y ago
i feel like i'd want operator overloading when dealing with quaternions, which zig eschews for no good reason
- the__alchemist 2y agoI just hit this, within minutes of starting... A cursory search implies this is a won't-fix: https://ziglang.org/learn/overview/#small-simple-language https://ziglang.org/learn/overview/#small-simple-language Operating overloading is considered hidden control flow. I appreciate that the team set made and are adhering to principles, but it does not mitigate the downside of this omission to me. I do a lot of scientific and numerical computing, and use vectors frequently. Non-overloaded vector syntax is tough to read and write. I'm aborting. This is an unfortunate decision.
- ksec 2y ago>I'm aborting. This is an unfortunate decision LOL. At least that is 20 min of trying. ( From the first message to above )
- the__alchemist 2y agoAfter some thought, I think I know why this is irritating. The domains I imagine Zig would be suited for are also ones where I use vector operations regularly. Almost a 1:1 overlap: - Embedded (Accelerations, velocities, positions) - Robotics - Games - Performance-critical scientific and numerical code (Cosmology, computational chemistry etc) - 3D graphics and visualizations
- otoburb 2y agoDid you try this with Julia too? Their vector & matrix support is literally first class.
- the__alchemist 2y agoHah yea. Julia's math syntax is the best I've seen, of any language. I wish rust and python etc had something similiar! Killer feature.
- cornstalks 2y agoZig has builtin support for vectors[1], which I think provides some alleviation. But sure, it's not as complete or flexible as a whole vector/matrix library. [1]: https://ziglang.org/documentation/master/#Vectors https://ziglang.org/documentation/master/#Vectors
- the__alchemist 2y agoGreat to know! From the description in that page and yours, it sounds like this is a related, but different concept. Specifically, that page includes use of a `Vec3` of the sort I was implementing, done with a `struct` and methods, vice @Vector.
- LeFantome 2y agoWas his research incorrect? How long should he continue to try to overcome what he believes to be a show-stopper constraint? He has other choices after all. If this represents a negative that out-weighs the positives, so be it. These same design decisions in Zig may make it a top tier option for other tasks. Just not this one.
- ksec 2y agoSorry I didn't mean to laugh at his effort. I was laughing more like I see this happening on HN in real time sort of mins after trying. I do think he has a point though. Not entirely sure how zig should tackle it or tackling it at all.
- trashburger 2y agoThis is what I felt initally, too. However, you easily become used to the lack of overloading, and since the language has method syntax sugar you can easily get used to .add() over +. I'd recommend you give it another shot.