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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6c13cc000274246b X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Please Help. Date: 1997/09/15 Message-ID: <341D4041.4AF8@gsfc.nasa.gov>#1/1 X-Deja-AN: 272652956 References: <01bcbcde$f8a425c0$ca70fe8c@default> <5vaude$q20$1@goanna.cs.rmit.edu.au> <5vbiid$luu$1@goanna.cs.rmit.edu.au> <34197042.7CFC@gsfc.nasa.gov> Reply-To: Stephen.Leake@gsfc.nasa.gov Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1997-09-15T00:00:00+00:00 List-Id: Robert Dewar wrote: > > Stephen says > > < some form of garbage collection to be used correctly. I hope that later > in the course, this will be pointed out. > > Which leads me to a question about the GNAT implementation of Unbounded > Strings; do they have their own storage pool, and does Free compact the > pool? One of these days I'll try to read the source.>> > > When we say that something is "nice for beginners", we are presumably saying > that students who want to write programs to do X will find it convenient to > use feature Y. But always remember that when we teach computer science, > writing programs as excercises is not about writing programs to do X, it is > about learning the fundamental concepts, and techniques. The programs we write > in class are a *means* to an end, not an end in themselves. This is a very > improtant difference. In the world of real life application programming, the > point is to create a working program that meets the specifications. When we > are teaching the point is to LEARN HOW to create! Excellent point, which I missed. It is definitely more important to learn the fundamentals. On the other hand, if your learning control structures, and you want to print a diagnostic message that is built from several strings, Unbounded_Strings are nice. > As to your technical question (gosh, a technical question on CLA, I had > forgotten that this could happen :-) Glad to oblige :) > GNAT uses controlled types to > implement unbounded strings. Using a special garbage collected pool is > an interesting idea which we have thought about (and which has been discussed > at length in previous CLA threads), but we have not yet followed up this > idea. As I thought. So Dale (if you're still reading :), will you be pointing out that using Unbounded_String does have a big downside? When you get to teaching about dynamic memory allocation and managment, you could point out that they've been doing it all along without thinking about it, just like a lot of professional programmers!. -- - Stephe