Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!csd4.milw.wisc.edu!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!p.cs.uiuc.edu!johnson From: johnson@p.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: Re: Eiffel vs. C++ (vs Smalltalk) Message-ID: <77300030@p.cs.uiuc.edu> Date: 10 Jun 89 15:25:00 GMT References: <5316@tekgvs.LABS.TEK.COM> Lines: 46 Nf-ID: #R:tekgvs.LABS.TEK.COM:5316:p.cs.uiuc.edu:77300030:000:2432 Nf-From: p.cs.uiuc.edu!johnson Jun 10 10:25:00 1989 Snorri Agnarsoon (snorri@rhi.hi.is) made some comments about my comments about assertions. Though he may not realize it, we agree. Then, in response to my comment on garbage collection, he says >In my opinion garbage collection is the single most useful feature >of a programming language. Without garbage collection polymorphism >is severely handicapped and programmers tend to shy away from clean >designs because of the restrictions imposed by the lack of garbage >collection. I am a Smalltalk and a C++ programmer. Smalltalk is a lot more fun to use, and I can build systems much faster with it. Garbage collection is a major reason, though probably >In my opinion garbage collection is the single most useful feature >of Prolog, LISP, SmallTalk, Eiffel, CLU, etc., etc. is an overstatement. However, my remark was specifically directed to real-time programming. Garbage collection does not get along very well with real-time programming. The Smalltalk garbage collectors are pretty good, usually only taking a fraction of a second to collect garbage. However, if this happened in a middle of an interrupt then even 1/4 a second is too long. I want every language I use to handle memory allocation and deallocation automatically. C++ constructors and destructors are nice, but are still too much work, and the examples that Snorri gave show that sometimes they are not sufficient. However, designing a language so that it provides complete memory management and still permits real-time control is an unsolved problem, as far as I know. True incremental garbage collection either requires special processor design or is very inefficient, and the real-time programming people don't like inefficiency, either. Thus, there are still very important application areas (and real-time programming is growing in importance) for which garbage collection is inappropriate. Many people do not know that it is possible to use a garbage collector in C++ or C. Hans Boehm has such a collector, which he developed for Russel. I just saw an announcement of a Modula-3 implementation, and they are using it, so it is pretty general purpose. This garbage collector is not fast, because it can make almost no assumptions about the layout of objects and so must be conservative. However, the main reason for a garbage collector in C++ would be to catch "space leaks", so it would not have to be called very often. Ralph Johnson