News for hackers. Stuff that matters.
Re:Why Go Can't Try by qezz on Monday March 02, 2026 @03:35PM (#47223679)
What I meant by "you need an allocator" is "you need to explicitly pass the allocator of your choice to the function" [if you want to attach some data to the error]. In rust you can simply return anything as error, not only an enum variant.
Re:Why Go Can't Try by tialaramex on Monday March 02, 2026 @06:10PM (#47225586)
But that's back to idiom. In this case specifically in Zig a common idiom is to pass an allocator to might-allocate functions such as the growable array push function, while in Rust it would be usual to weld the allocator choice to the type itself with a constructor function e.g. Vec::with_capacity_in.