3 ms·
Zig is great, played with it a bit to compile to WASM and found it to be pretty easy to work with. That said, they're not winning on the docs, community and ma
by tjkrusinski 2y ago
Zig is great, played with it a bit to compile to WASM and found it to be pretty easy to work with.
That said, they're not winning on the docs, community and marketing front vs Rust. It's not really apples to apples, but it's a comparison people naturally draw.
- sroussey 2y ago> The latest release of Zig is 0.13.0 and is currently unstable. The unstable part might be why. That said, I’m a little familiar with it as it’s what Bun uses.
- sramsay 2y agoFor me, it's the library problem. I read the guide and think, "Wow, this is really great!" Then I read the cookbook, and it mostly says that things (like database connectivity, regex, options parsing, even HTTP GET) are not quite ready for prime time, and I should just call out to C. Obviously, it takes time for a language to get there; I don't really mean this as a criticism. But I'm just not interested in wrapping C libraries while I wait for a zig version. I'd rather just write C. Or work in a language that is there with these kinds of things.
- pyrolistical 2y agoSince c abi powers the world, with zig’s ability to easily wrap c libs, not only does zig have access to all libs; it also makes it easy to integrate zig with any existing project as most programming languages have integration with c. This is why everybody says just use some existing c lib
- sramsay 2y agoHmm. I could substitute lots of languages for zig in that first sentence. But that doesn't invariably lead the communities that maintain those languages to utter the second. I also doubt I have space to enumerate the languages that claim to "easily wrap c libs." None of them easily do that. That statement imagines that there's some basic consistency between APIs (and that those APIs are asking for and returning fairly simple types).
- lukaslalinsky 2y agoThe thing is, all valid C types are also valid in Zig. You just `@cImport` the header file and use it. You don't need to wrap the API, you just use it.
- pyrolistical 2y agoI would argue zig had the best c integration. This is why it’s different.
- sramsay 2y agoBetter than C++? Better than Lua?
- throwawaymaths 2y agoarguably Zig's c integration is better than c's c integration.
- sramsay 2y agoHow so? (If you're hearing a combative tone, it's unintended; I'm asking seriously, because I would love for this to be true!)
- rc00 2y agoIn C, C imports are in the global namespace. The language is also compiled sequentially, so often, time is spent ensuring headers are included in the proper order, hopefully avoiding a cyclic dependency. In Zig, C imports are done in a struct with a local namespace or imported package definition and the ordering is not relevant to compilation. I think parent means that Zig is a better language with regards to being the target for C to be imported into than C and that is the benefit of being a more modern language with flexibility following more modern conventions. This is combined with the mostly seamless ability to utilize most C functions and types without too much strife.
- hardwaregeek 2y agoIn fairness to Zig, they're quite a bit younger. I have no doubt they'll catch up
- 2c2c2c 2y agoproblem is that the language started hitting its stride and getting attention while the core team is on a 2 year side quest of rewriting the compiler + incremental compilation