Re:My Experience of building Bytebeat player in Zig
by dundarious on Friday November 07, 2025 @04:11PM
(#45851157)
That would get you almost none of the benefits of arenas and other types of allocators. Recommend https://www.rfleury.com/p/untangling-lifetimes-the-arena-all...
[ Parent
| on HN ]
Re:My Experience of building Bytebeat player in Zig
by im3w1l on Friday November 07, 2025 @05:11PM
(#45851770)
I know what arenas are but I don't see how passing something explictly vs implicitly matters except for which style people prefer?
Re:My Experience of building Bytebeat player in Zig
by dundarious on Saturday November 08, 2025 @11:09PM
(#45862829)
For one, you don't want exactly one arena or allocator for all tasks.
Re:My Experience of building Bytebeat player in Zig
by im3w1l on Sunday November 09, 2025 @12:35AM
(#45863195)
Well you couldn't you just use a different one in that case? The variable would just be like a suggestion.
Re:My Experience of building Bytebeat player in Zig
by dundarious on Sunday November 09, 2025 @01:14AM
(#45863369)
Most programmers don't prefer thread local mutable state over a single pointer argument. Especially for general purpose code (i.e., not specific to a single purpose/project). With the mutable state version, you have to clearly define which state you're using and when (which named allocator/arena variable), and if you're mutating it in place and then restoring it, there can be some pretty obvious issues.
Given this thread is completely off the rails from anything specific to allocators or arenas, and even Zig, I will now exit.