5 ms·
I get the usefulness of allocators, I just don't see them as useful enough where I'd pick zig over another established systems programming language. Do you have
by laszlojamf 3mo ago
I get the usefulness of allocators, I just don't see them as useful enough where I'd pick zig over another established systems programming language. Do you have an example?
- chaz72 3mo agoI think Zig would do better than Go at things like kernels, drivers, game engines, lower level sorts of things. Edited to add the obvious: SPIR-V, for instance. Of course there’s lots of programming that can afford to pay for GC side effects, if there weren’t we wouldn’t have invented GC, but it’s a little less universal, a little less ‘system’. For me, I came to Zig after horrible cross-platform experiences led me to try going all the way back to C and I found that I was spending way too much time learning to deal with accidental complexity instead of essential complexity. (Respect to the C masters but I failed to adapt.)
- PunchyHamster 3mo ago>I think Zig would do better than Go at things like kernels, drivers, game engines, lower level sorts of things. Edited to add the obvious: SPIR-V, for instance. But people don't write those in Go, they use Rust for it
- chaz72 3mo agoMy specific reply was to laszlojamf saying “it seems like go, but with manual allocation”. To your point though, if Rust is getting it done, go for it. A lot of people still write those in C though.
- pjmlp 3mo agoYes they do. Only those with anti-GC bias don't. Which is why TamaGo, TinyGo and gVisor exist.
- dnautics 3mo agoa lot of heavy duty systems have multiple allocator systems. the erlang virtual machine has 12: https://www.erlang.org/docs/25/man/erts_alloc.html https://www.erlang.org/docs/25/man/erts_alloc.html jvm has at least 5: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/memory/allocation.hpp https://github.com/openjdk/jdk/blob/master/src/hotspot/share... postgres has at least 8: https://github.com/postgres/postgres/blob/master/src/backend/utils/mmgr/README https://github.com/postgres/postgres/blob/master/src/backend... since zig anoints an allocator interface in its stdlib, your (and the stdlib's) data structures which use allocators can be trivially reused across different allocation strategies without rewriting code; and very likely (not guaranteed ofc) if you bring in someone else's code they will cleave to convention.
- nesarkvechnep 3mo agoJust yesterday I was thinking about the BEAM and would it be tidier if it were written in Zig.
- pjmlp 3mo agoJVM has surely more than 5, because the ecosystem enjoys multiple implementations.