top | item 46677788

(no title)

blubber | 1 month ago

Isn't Zig's repetitive ceremonial code around allocators+ allocation + defer *.deinit() a sign of a serious shortcoming like golang's error handling? If zig is so good at metaprogramming, why isn't there a metaprogramming solution to this repetitive code?

discuss

order

jordand|1 month ago

Memory allocations are always done explicitly (nothing is hidden or implicit). I've not written enough Zig yet to appreciate that, but I've hit plenty of those issues year-after-year with C++ to know their approach is sane and rational.

Measter|1 month ago

Memory allocations in Rust are also always done explicitly, but Rust's library types don't have APIs that allow you to get it wrong.