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,b0f4738b8e27cca3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-25 10:39:46 PST From: "Ekkehard Morgenstern" Newsgroups: comp.lang.ada Subject: Re: Problem with protected type Date: Tue, 25 Nov 2003 19:39:48 +0100 Organization: 1&1 Internet AG Message-ID: References: NNTP-Posting-Host: p508c004b.dip0.t-ipconnect.de X-Trace: online.de 1069785585 4881 80.140.0.75 (25 Nov 2003 18:39:45 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Tue, 25 Nov 2003 18:39:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor-online.net!news.belwue.de!news.uni-ulm.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Xref: archiver1.google.com comp.lang.ada:2933 Date: 2003-11-25T19:39:48+01:00 List-Id: "Robert I. Eachus" schrieb im Newsbeitrag news:Kp6dnRXjpqyY416iRVn-sw@comcast.com... > > 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: > > EventObject : CoreEvent; <---- Thanks. I didn't realize was creating an object named BaseEvent, I omitted the "type" keyword. > 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, How could I declare the CoreEvent record layout as private without putting the declaration in the private section? > 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.) That's true, I wanted to declare a type, not an object. ;-) > I would think that the intent is to have several objects of type > BaseEvent, so the latter would be the best fix. Yes! > 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. Ok. > 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. Thanks. I didn't know that! :-)