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,319dd710e797e8a2,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Protected type defined in the procedure Date: Wed, 28 Sep 2005 10:10:33 +0200 Organization: CERN - European Laboratory for Particle Physics Message-ID: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1127895033 24795 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050913 Red Hat/1.7.10-1.4.2.SL3 X-Accept-Language: en-us, en Xref: g2news1.google.com comp.lang.ada:5221 Date: 2005-09-28T10:10:33+02:00 List-Id: Hi, While learning Ada I have found the following problem. It is possible to define a task within some procedure, like here: procedure Hello is task SomeTask is -- ... some entries end SomeTask; task body SomeTask is begin -- ... (2) end SomeTask; begin -- ... (1) end Hello; At some point I decided to use a protected object to act as a shared data between (1) and (2). I was unable to find any way to define appropriate protected type within the Hello procedure. Separate package helped with this, but the question remains: is it at all possible to define a protected type (*all* of it, including implementation of its procedures, functions and entries) within the procedure where it is supposed to be used? I find it to be reasonable, especially when compared with the possibility of defining the whole task this way. In fact, the protected object is not going to be used outside of the Hello+SomeTask combo, so there is no need to pollute the project with separate packages just for things like this. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/