4 ms·
Curious about the choice of Zig, any specific reason for using it?
by hiatus 3y ago
Curious about the choice of Zig, any specific reason for using it?
- seabrookmx 3y agoProbably because it has a super nice build toolchain, especially when you consider cross compilation. There's quite a few folks using zig _just_ for the toolchain, while still writing C.
- NilsIRL 3y agoThe main reason Zig was chosen is because the project was started at a hackathon[0] at which there was a prize for "best use of Zig". Beyond that there were also other reasons: 1. I have been wanting to try out Zig 2. It fit the requirement of being a so called "systems language". However having written it in Zig I have a few retroactive reasons for why Zig was a good choice (if not the best choice): * The build system allows to make the runtime a dependency of the "compiler". I don't think any other language has that. * The interoperability with C/systems calls is amazing (in comparison to anything but C/C++) * The ability to embed files * Makes it incredibly easy to make static binaries [0]: https://treehacks.com/ https://treehacks.com/ [1]: https://github.com/NilsIrl/dockerc/blob/68b0e6dc40e76c77ad0c94123f77829cf6c91b61/build.zig#L41 https://github.com/NilsIrl/dockerc/blob/68b0e6dc40e76c77ad0c...