News for hackers. Stuff that matters.
Re:Zig 0.8.0 Release Notes by c0ast on Friday June 04, 2021 @11:19PM (#27401797)
With regards to RAII (as in constructors/destructors, not the stuff in the issue you linked), I think it simply didn't fit within Zig's goals. A big part of Zig is readability; what you read is what you get, and RAII is very much not that. Looking at a block of C++ code, there's no way to tell what happens unless you also know what the constructors/destructors of each data type in the block does.
Re:Zig 0.8.0 Release Notes by PoignardAzur on Saturday June 05, 2021 @06:33AM (#27403796)
I wonder if Zig could add a "mustbedestroyed" annotation to a type, that doesn't actually add RAII-style invisible code, but forces developers do add 'defer' instructions to code that creates instances of the type.

EDIT: Aaand shockingly, I'm not the first to come up with this idea: https://github.com/ziglang/zig/issues/782

Re:Zig 0.8.0 Release Notes by adrusi on Saturday June 05, 2021 @01:39AM (#27402532)
And more concretely, a language design rule of thumb in Zig is that if a function is called, there should be an explicit function call. Zig offers defer and errdefer as the closest substitute for RAII that makes all calls explicit.
Re:Zig 0.8.0 Release Notes by lenkite on Saturday June 05, 2021 @06:20PM (#27408881)
Destructors don't do any strange thing in C++ apart from closing allocated resources - so in reality you always know what happens. This presents mistakes and decreases code length in calling code.