← Back to context

Comment by SuperV1234

4 days ago

It's not a good thing. The reasoning is extremely simple and I don't understand how can anyone oppose it: there are some operations that you don't want to forget BY DEFAULT.

If I open a file, eventually I want to close it. If I allocate some memory, eventually I want to deallocate it.

Any programming language design that intentionally puts the onus BY DEFAULT on the user to *not forget to manually do something* is honestly asinine.

Defer has a place (I do use defer in C++, in fact you can implement it with RAII, proving that RAII is strictly more powerful/more flexible), but the default should be the safest and most straightforward option.

Also "magic-sauce that does a lot for you" is just false. It's literally a function call injected at the end of a scope.