From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.misc:1369 comp.lang.modula2:732 comp.lang.ada:1088 Path: utzoo!mnetor!uunet!husc6!think!ames!amdahl!pyramid!prls!philabs!micomvax!zap!fortin From: fortin@zap.UUCP (Denis Fortin) Newsgroups: comp.lang.misc,comp.lang.modula2,comp.lang.ada Subject: Re: From Modula to Oberon Message-ID: <429@zap.UUCP> Date: 29 Mar 88 13:47:01 GMT References: <145@krafla.rhi.hi.is> <272@fang.ATT.COM> Reply-To: fortin@zap.UUCP (Denis Fortin) Organization: (none), Montreal QC, Canada List-Id: In article <272@fang.ATT.COM> cbseeh@fang.ATT.COM (Edmund E Howland) writes: >>> [talking about the definition of the Oberon language posted recently >>> to comp.lang.modula2] >> In my opinion Oberon is a significant improvement over Pascal, Modula-2 >> and Ada in one respect: It has automatic garbage collection. This feature >> is enough to choose Oberon over the other three. > >Huh? >Since when have these three ever had a need for garbage collection? >I am not too familiar with Ada, but garbage collection exists in >languages for whom dynamic binding is a way of life, not an option. (note: the stuff below applies equally well to Modula-2 or Ada, although it is a bit more Ada-specific) Actually, Ada *allows* but does not not *require* the existence of a garbage collector (LRM section 4.8 paragraph 7). While I agree that for real-time embedded applications, a garbage collector can be annoying (though there are incremental algorithms that make this less true), in a language that encourages information-hiding, a good garbage collector is almost a must (in my opinion). The problem is that users might be using modules/packages that contain hidden pointers to dynamic data. Without garbage collection, you have to have a free/dispose/unchecked_deallocation routine available for all hermetic data types you export, otherwise code will be written that does not release variables of that type after using them and if at a latter point you change the implementation of the hidden data type (which you SHOULD be able to do, that's why you hid it's true contents in the first place) and stick a pointer/access variable in it, then you're stuck -> your heap will slowly erode away! Actually, by not requiring that a user call a "free" routine for all variables of data types you export (those where implementation is hidden), you are allowing him/her to make a very important assumption about the way your data type is implemented (which is bad). Of course, one CAN export a "free" routine with *ALL* data types, but then it becomes a real pain to write code that uses the data type. For example, a "dynamic string package" would require that you call "free(...)" for all of the string variables you declare at the end of each block that declares such variables -> this is not only notationally painful (!?), but also very error-prone. Anyway, I've been involved in a 75000+ lines Ada project, and every time I can talk to Ada compiler vendors, I always ask them *when* garbage collection will finally be available for their compiler. (Put in a pragma to turn it off for real-time applications or something...) (Actually, the two biggest demands that my group had for Ada compilers (besides the obvious "fast compile" and "fast execution") where "fast tasking" and "garbage collection"!) Sigh, it felt good getting this off my chest :-) -- Denis Fortin | fortin@zap.UUCP CAE Electronics Ltd | philabs!micomvax!zap!fortin The opinions expressed above are my own | fortin%zap.uucp@uunet.uu.net