Hacker News
points by silon42 1 day ago | 0 comments
You could easily have explicit RAAI... the compiler just needs to complain until you write all drop(x) explicitly. Maybe an idea for future of Zig.
[–] GuB-42 1 day ago
To me, that's not RAII, it is static analysis, useful, but different.

To me, the name "Resource Acquisition Is Initialization" implies that doing one means the other one is done implicitly. Now, in the end of the day, the result is machine language, with proper discipline you can follow the RAII principles in any languages, including assembly, but I have always understood RAII as being it done implicitly.

Also we can argue that Zig supports a weak form of RAII through the use of "defer", there are some nuances here.

Hacker News