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.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51359402da60c472 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-18 23:39:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail Message-ID: <3EF15A7C.4030901@attbi.com> 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: DYNAMIC ADA TASK CREATION? References: <3EF0026E.2050309@attbi.com> <3EF0F57D.9060507@attbi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1056004772 24.62.164.137 (Thu, 19 Jun 2003 06:39:32 GMT) NNTP-Posting-Date: Thu, 19 Jun 2003 06:39:32 GMT Organization: AT&T Broadband Date: Thu, 19 Jun 2003 06:39:32 GMT Xref: archiver1.google.com comp.lang.ada:39431 Date: 2003-06-19T06:39:32+00:00 List-Id: I said: >>If you really want to. If the task is created with an allocator, >>you can test for TA(...)'Terminated and call an instance of >>Unchecked_Deallocation for the task access value. (You can call >>Unchecked_Deallocation on an unterminated task, but it is not a good >>idea, in general. It is a bad idea if the task has discriminants.) After I answered Simon's question, I realized that the information in the Ada Reference Manual can really be divided into three parts: 1) (The smallest.) What you need to know to develop good software in Ada. 2) How to shoot yourself in the foot, if you really want to. 3) Where the bullet may go if you choose something from the second section. But what is totally missing from the RM is why shooting yourself in the foot is a bad idea. In this case, all the ordinary programmer should need to know is: A. Deallocating an unterminated task is certain not to be useful. B. Deallocating a terminated task is probably just as useless, but harmless. So why does the Ada RM spend so many words on this case? Othogonality. There are times when a programmer will create an object type that contains tasks. And he may want to use, say, a container package for objects of this type. (Yes, most container libraries refuse to work with limited data objects, but not all.) So the Reference Manual has to carefully define what happens when you deallocate a task object so that everything works together the way it should in that case. It is just like that discussion of garbage collectors for Ada. Are they allowed? Sure. Does the Reference Manual go to great lengths to allow Ada implementations for environments that have garbarge collectors? Sure, in fact there have been several Ada compilers that did target machines with garbage collection. The most popular was probably the Ada 83 Symbolics compiler. But should any user care if the target environment supports garbage collection? Of course not. Creating garbage in Ada means you are in section 2 or section 3, not section 1. There are debuggers, tools and special compiler options to allow you to find where garbage is being created in an Ada program. But they are useful precisely because ANY garbage in an Ada program is evidence of a bug. This used to not be true. In fact Dave Emery and I got criticized for distributing a package for reading and using command line parameters that left garbage behind. Of course, it was a copy of the command line parameters, and no matter how many times you used the facilities in the package, there was still at most one copy of the command line that could be considered garbage. How did we fix it? Got Ada.Command_Line, and Ada.Strings.Unbounded added in Ada95. How's that for a belt and suspenders fix. ;-)