The problem with RAII is that unlike defer it requires you to have an exception mechanism. RAII and Exceptions are completely interdependant and you can't use one without the other (you're basically guaranteed leaks if you use exceptions without RAII and to implement RAII you need exceptions).
It's valuable but let's not confuse it with defer which allows a great deal of safety without requiring exceptions.
It's valuable but let's not confuse it with defer which allows a great deal of safety without requiring exceptions.