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-Thread: 103376,901038687c38f61c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: Subject: Re: Idiom for a class and an object in Ada Date: Wed, 20 Oct 2004 13:04:47 -0400 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: <41769aaf$0$91004$39cecf19@news.twtelecom.net> Organization: Time-Warner Telecom NNTP-Posting-Date: 20 Oct 2004 17:04:47 GMT NNTP-Posting-Host: 357b086d.news.twtelecom.net X-Trace: DXC=RI02FEb31ZmngZ=SdGQOKiC_A=>8kQj6mhHXa^^g6TZdLIK5ZkUUj_mdYZAA8S:?6@CAHh X-Complaints-To: abuse@twtelecom.net Xref: g2news1.google.com comp.lang.ada:5534 Date: 2004-10-20T17:04:47+00:00 List-Id: "Simon Wright" wrote in message news:x7v4qkqrlr1.fsf@smaug.pushface.org... > > package body ADC is > > task type T is ... > type T_P is access T; > Converter_1 : T_P; > > begin > > Converter_1 := new T (...); > > end ADC; This doesn't buy you anything. The rule is that the "task object" elaborates in linear order (the same as for any other declaration), but then the "task" itself "activates" when the begin statement is reached. We can write your example as: package body ADC is task type T; O : T; -- this is the "task object" task body T is ... end; end; No explicit allocation is necessary. Task object O elaborates in the normal way, and its associated task activates at the completion of elaboration of the package body. The distinction between "task object" and "task", and between "elaboration" and "activation", is somewhat subtle.