If you look at Swift you will see, that it has all all the mechanisms above. defer {} for the cases where RAII is just to much boiler plate code. Enums with associated types for wrapping results together with errors (unfortunately the standard library is not there yet) and a try-catch mechanism that has the added bonus that it uses error objects instead of exceptions and the compiler enforces catching in the current context so you don't have exceptions flying all over the place.
Actually I don't think you can generally say that one concept is better than the others for all cases. As always: trade-offs
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If you look at Swift you will see, that it has all all the mechanisms above. defer {} for the cases where RAII is just to much boiler plate code. Enums with associated types for wrapping results together with errors (unfortunately the standard library is not there yet) and a try-catch mechanism that has the added bonus that it uses error objects instead of exceptions and the compiler enforces catching in the current context so you don't have exceptions flying all over the place.
Actually I don't think you can generally say that one concept is better than the others for all cases. As always: trade-offs