3 ms·
> But a lot of real world software just isn't that simple. Zig doesn't force or even tends to prefer one way or another. If I want unassuming heap allocations
by boomlinde 8d ago
> But a lot of real world software just isn't that simple.
Zig doesn't force or even tends to prefer one way or another. If I want unassuming heap allocations that can be reclaimed in any order, there's an allocator for that. If I want an arena to discard at the end of something like a request or a video frame, there's an allocator for that. If I want to use a fixed backing buffer for the allocations, there's an allocator for that.
The point is that the standard library doesn't assume one or the other, which seems good if the problem is that "real world software just isn't that simple" in the more general sense that there's no one-size-fits-all allocation strategy.
- NetMageSCW 8d agoBut for how many software domains are allocators more specialized than a single built-in general purpose one so important it should be the focus of your language?
- boomlinde 6d agoHow many seems like an irrelevant question to me. If there are such software domains at all, Zig may be a compelling alternative to languages that don't have a standard library that lets you choose an allocation strategy freely. I also disagree that this is "the focus" of Zig. Technically speaking it seems like a rather minor design choice for the standard library.