From: Edward Diener Date: 2001-11-24T16:58:28+09:00 Subject: [ruby-talk:26300] Re: [OT] Re: KDE or GNOME curiosity question... Dave Thomas wrote: > Edward Diener writes: > > >>>Ruby and many other languages with GC (Java is in the same boat) allow >>>resource finalization when the object is "destroyed". >>> >>I know what the workaround is generally for these RAAI situations. It is >>to design a member function that essentially says that the object will >>no longer be used and therefore resources can be released when the >>member function is called. Then it is up to the user of that object to >>remember to call that member function when he is finished using that >>object. To say that I regard this as inelegant and a poor language >>design is an understatement. >> > > Perhaps you could post one of your current Ruby applications that > illustrates the problem, and we might be able to help you out. > I am discussing a language issue that is easy to understand. Any OO language has this issue and the crux of it is: If I, as a programmer, can create an object at a certain point in my code, I should be able to have that object destroyed, whether automatically or through a language construct, at a certain point in my code. GC essentially says that it will decide when an object is destroyed. If you can't see the problem with that GC scheme with certain types of objects which encapsulate the RAAI concept, as well as objects which must be created and destroyed in some sort of ordered sequence, then there is no point in discussing the issue. If you can see the problem but feel it is a minor one or something that rarely occurs in your design of code, I can at least understand that although I personally disagree that this is not a large issue in GC languages. Having designed classes and frameworks in C++, I find Java, Python, and Ruby's non-support for the ordered destruction of objects somewhat irritating to the way I design and program. I don't like the kludges and workarounds to this general problem and strongly feel that a good language, and I include Ruby as a good language, should have a natural solution to this problem as part of the syntax of the language rather than just ignoring it as an issue.