News for hackers. Stuff that matters.
Re:Lies we tell ourselves to keep using Golang by bsaul on Tuesday November 26, 2024 @04:04AM (#42243840)
How does RAII works in concurrent systems ? It seems to me you need to add compile-time object lifetime evaluation (as in rust) which so far incurs a high toll on language complexity.
Re:Lies we tell ourselves to keep using Golang by maleldil on Tuesday November 26, 2024 @05:00AM (#42244203)
The exact same way it works in Rust. C++'s RAII works the same as Rust's Drop trait. The object is released when it goes out of scope, and if it's shared (e.g. Arc), it's released when the last reference to it drops.