> You still need to take care of all those resources - which means lots and lots of catching and rethrowing, not unlike C code which tries not to leak.
Pretty much every language out there offers features to avoid the catch-and-rethrow mess: with statements in Python, using statements in C#, destructors in C++, even Java has try-with-resources nowadays! And let's not mention finally blocks which have been around forever...
> (btw, have a look at the mess which is IDisposable in .NET framework - Microsoft developers had to decide whether to implement IDisposable when they designed each base class and interface in the standard library - based on an idea what those *inheriting* those classes might want to do - guess how many times they got that wrong; I do not blame them for it, seems like GC is simply the wrong idea if you want robust code which uses any external resources
The right way to use IDisposable is through a using statement, not through the GC.
Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds