2 ms·
You don't need allocations to be part of the language, you just need destructors (or linear types.) But the Zig authors intentionally omitted destructors becaus
by creata 5y ago
You don't need allocations to be part of the language, you just need destructors (or linear types.) But the Zig authors intentionally omitted destructors because they want all control flow to be explicit. There's more at [0].
Side note: the proposal at [0] seems very close to [1].
[0]: https://github.com/ziglang/zig/issues/782 https://github.com/ziglang/zig/issues/782
[1]: https://www.haskellforall.com/2013/06/the-resource-applicative.html https://www.haskellforall.com/2013/06/the-resource-applicati...
- creata 5y agoToo late to edit, but: I'm an idiot, I was thinking of memory leaks, not use-after-free.