3 ms·
How does this compare to Zig? They seem to share the same problem space.
by icy 4y ago
How does this compare to Zig? They seem to share the same problem space.
- ddevault 4y agoHare is much simpler than Zig and has a much different design, things like Zig's comptime is absent in Hare. Hare also has, in my opinion, a more fleshed out standard library than Zig. However, they don't compete in some respects: Zig targets nonfree platforms like Windows and macOS, and being based on LLVM gives Zig a greater range of platforms/architectures OOTB. Andrew might be able to expand on this.
- icy 4y agoGotcha. One thing that I really liked about Zig is its effortless interop with C. How does Hare compare in that regard?
- ddevault 4y agoHare uses a superset of the C ABI and interop with C should be relatively straightforward. You can see an example with SDL2 here: https://git.sr.ht/~sircmpwn/hare-examples/tree/master/item/sdl2.ha https://git.sr.ht/~sircmpwn/hare-examples/tree/master/item/s... We have some planned improvements which will make this easier still. We'd like to improve the build driver's ability to link with C libraries via pkg-config, and automatically rig it up when you depend on C interop modules like hare-sdl2. Code generation to automatically provide bindings going either direction is also something we'd like to work on. Zig goes, imho, a little bit too far. Hare has no intention of providing a built-in C toolchain, and does not treat C as more special than any other language for interop. It's a question of scope.
- turminal 4y agoIt's trivial for Hare programs to interop with C. All the programmer has to do is specify the libraries they want to link to. Going the other way and calling Hare code from C is not that smooth yet, but there are plans to improve that in the future.
- ifreund 4y agocomptime is absolutely the biggest difference, in Zig you'll find high quality, performant generic hash map implementations in the standard library. In hare there are no generics and you are encouraged to write your own hash maps as needed: https://harelang.org/blog/2021-03-26-high-level-data-structures/ https://harelang.org/blog/2021-03-26-high-level-data-structu...