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,b0f4738b8e27cca3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-25 08:07:01 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 25 Nov 2003 10:06:29 -0600 Date: Tue, 25 Nov 2003 11:06:28 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problem with protected type References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.34.214.193 X-Trace: sv3-4Vtmrh6Pk6bYyZXTQa6BonJLjbnL4aKJXp/KQ0Ho3VFz3ZVT6OW+yc9rPkAUHFxty7LyS6gFj/YUCFn!+z0fXasMIMQPZOaZuoju5X6N8myre6Y4I+MYXryysv505gt7SRATdjVnJUW/hg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:2926 Date: 2003-11-25T11:06:28-05:00 List-Id: Ekkehard Morgenstern wrote: > But why is this necessary? It isn't in general. What you are missing is a complete definition of CoreEvent before you try to create an object of the type: type CoreEvent is limited private; protected BaseEvent is entry Wait; procedure Signal; procedure ManualMode; procedure AutoMode; procedure Reset; function IsSignaled return Boolean; private EventObject : CoreEvent; <---- ManualReset : Boolean := FALSE; end BaseEvent; Replacing EventObject by a pointer to CoreEvent eliminates the need for "knowing" the size of CoreEvent. Other fixes would be to complete the declaration of CoreEvent before the declaration of BaseEvent, or to make BaseEvent a protected type, then not create any objects of the type in the public part of the package specification. (You may want to create such objects in child packages.) I would think that the intent is to have several objects of type BaseEvent, so the latter would be the best fix. This principle of linear elaboration order is followed thoughout Ada. There are cases where it is a pain, and other cases where it has benefits. But there needs to be one rule for such things, and this rule was chosen as the simplest for users to understand. Incidently, there is no language rule against the style of identifier you are using, but Ada compilers and editors do a better job of supporting Base_Event instead of BaseEvent. For example the emacs ada-mode I use automatically converts BaseEvent to Baseevent unless I go to extra effort. -- Robert I. Eachus 100% Ada, no bugs--the only way to create software.