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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f0b59438ce4c5b9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-19 08:38:55 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc53.POSTED!not-for-mail Message-ID: <3F92AFF6.8050001@comcast.net> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Deallocation & Tagged Types References: <5Fhkb.3195$KA5.27417@newsfep4-glfd.server.ntli.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc53 1066577934 24.34.139.183 (Sun, 19 Oct 2003 15:38:54 GMT) NNTP-Posting-Date: Sun, 19 Oct 2003 15:38:54 GMT Organization: Comcast Online Date: Sun, 19 Oct 2003 15:38:54 GMT Xref: archiver1.google.com comp.lang.ada:1136 Date: 2003-10-19T15:38:54+00:00 List-Id: chris wrote: > Is there another way that I'm missing or is this how people do this in > their code? This is what Controlled types were added to the language for, why aren't you using them? In your example, if Vehicle is a controlled type, you don't have a problem. If Vehicle has no required finalization, it doesn't need to be derived from Controlled (or Limited_Controlled) but again, as the programmer of an abstraction that uses Vehicle, you don't have to worry about it. Incidently this is as I see it the biggest problem that programmers moving from C++ or other OO languages to Ada have. Ada programmers are used to trusting the developers of each abstraction to manage storage, initialization, and a lot of other things correctly. Programmers new to Ada spend a lot of time worrying about these things that Ada programmers take for granted. I can say, teach, describe, whatever this attitude, but it takes years for the worry to go away. (Note: I understand that if someone programs an abstraction incorrectly, that is a problem. But it is also a bug in the ADT that needs to be fixed there. Code that includes workarounds for bugs in the ADTs used is twice wrong. Once because the original type should be corrected, and the second time because fixing the base abstraction is now going to create a follow-on bug.) -- Robert I. Eachus "Quality is the Buddha. Quality is scientific reality. Quality is the goal of Art. It remains to work these concepts into a practical, down-to-earth context, and for this there is nothing more practical or down-to-earth than what I have been talking about all along...the repair of an old motorcycle." -- from Zen and the Art of Motorcycle Maintenance by Robert Pirsig