On the Odin vs Zig allocator bit:
In Zig you pass an allocator to every function that allocates, even if it doesn't make a lot of sense.
const arr = std.ArrayList(i64).empty;
arr.append(allocator, 1);
arr.append(allocator, 2);
arr.append(allocator, 3);
This rarely makes sense, as it's not really useful to append using a different allocator than you used previously.In Odin, allocators are passed in the init, stored as part of the struct and reused in the append.
arr := make([dynamic]i64, 0, 10, context.allocator)
append(&arr, 1)
append(&arr, 2)
append(&arr, 3)That's just a matter of wrapping the allocator if you feel fhat is better approach. Question is, should there always be an allocator around with arr or do you want to split a build phase from an immutable use phase.
[dead]
That's because in Zig that would be seen as a surprise side effect - the allocator is expected when the action is performed, not when it's "prepared", this way you know append() allocates. Otherwise it wouldn't be explicit which Array methods allocated.
The Odin way is useful, too. Depends on what you're building.