Hacker News new | ask | show | jobs
by leduyquang753 757 days ago
Did you even read the article? The part where it talks about problems with destructors is about halfway through.
2 comments

TBF the essay is rather strangely structured, the entire two thirds of the essay covering constructors and overloading has only ancillary relevance to the actual problem, Rust has neither and does RAII just fine after all (though it does have name mangling).

The author even acknowledges halfway through that it’s basically a strawman:

> It’s not a bad argument; after all, the entire above argument hinges on the idea of stealing from C++ entirely and copying their semantics bit-for-bit.

To me, only after that does it engage with the underlying concept in a way which is engaging and convincing. But you’ve had to trawl through 2500 words to get to that point.

They assume C++-like destructors. Other languages, like Zig, do a good job with syntax like `defer`
They don’t “assume” C++-like destructor, they’re the primary author of the N3199 “defer” proposal for C.

This is a response to people contacting / criticising them asking for destructors instead of defer.

The entire point of the blog post (written by the author of the C defer proposal) is to motivate why C should have defer. It is an attempt to summarize one of the most common criticisms of the proposal.