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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8a3e2ce4e6d56336 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-12 08:16:03 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!cambridge1-snf1.gtei.net!news.gtei.net!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: Generic Formal Parameter for a Task Type Date: Mon, 12 Mar 2001 11:14:16 -0500 Organization: AverStar (formerly Intermetrics) Burlington, MA USA Message-ID: <3AACF5D8.6719A9A9@averstar.com> References: NNTP-Posting-Host: nebula.burl.averstar.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 984413657 7964 141.199.8.77 (12 Mar 2001 16:14:17 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 12 Mar 2001 16:14:17 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:5644 Date: 2001-03-12T16:14:17+00:00 List-Id: "Robert C. Leif, Ph.D." wrote: > > From: Bob Leif > To: Tucker Taft et al. > You wrote: > "If you wanted to avoid generics, you could define an abstract limited > tagged type (say "Has_Task") which had various (abstract) primitive > operations, including at least a "Task_ID" function. You would then > extend from this type by adding a component of the task type of interest > (and of course override the abstract primitives as appropriate)." > > Can you include the "Has_Task" in a generic package; or are the two > approaches mutually exclusive for tasks? As I mentioned, you can declare a formal derived type, such as generic type My_Task is new Has_Task with private; ... and inside the generic use the My_Task type to create tasks and query the information about instances of the type. I wrote earlier: > ... > Why not have a formal function that returns the Task_ID, rather > than 'Terminated? That way, you can use the Ada.Task_Identification > and Ada.Task_Attributes packages to get whatever else you need from the > task, including task attributes... > > If you wanted to avoid generics, you could define an abstract limited > tagged type (say "Has_Task") which had various (abstract) primitive > operations, including at least a "Task_ID" function. You would then > extend from this type by adding a component of the task type of interest > (and of course override the abstract primitives as appropriate). > You could then manipulate objects of type Has_Task'Class, or references > there-to, in a "Java"-like way ;-). You could also pass in any > extension of Has_Task to a generic with a formal tagged derived type > of "type My_Task is new Has_Task with private;". > > The possibilities are endless... -- -Tucker Taft stt@avercom.net http://www.averstar.com/~stt/ Chief Technology Officer, AverCom Corporation (A Titan Company) Burlington, MA USA (AverCom was formerly the Commercial Division of AverStar: http://www.averstar.com/services/ebusiness_applications.html)