From: "Ekkehard Morgenstern" <ekkehard.morgenstern@onlinehome.de>
Subject: Re: Problem with protected type
Date: Tue, 25 Nov 2003 19:39:48 +0100
Date: 2003-11-25T19:39:48+01:00 [thread overview]
Message-ID: <bq07lh$4oh$1@online.de> (raw)
In-Reply-To: Kp6dnRXjpqyY416iRVn-sw@comcast.com
"Robert I. Eachus" <rieachus@comcast.net> 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! :-)
next prev parent reply other threads:[~2003-11-25 18:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-25 15:15 Problem with protected type Ekkehard Morgenstern
2003-11-25 15:43 ` Ekkehard Morgenstern
2003-11-25 16:06 ` Robert I. Eachus
2003-11-25 18:39 ` Ekkehard Morgenstern [this message]
2003-11-26 15:43 ` Robert I. Eachus
2003-11-25 16:45 ` Ludovic Brenta
2003-11-25 18:45 ` Ekkehard Morgenstern
2003-11-25 20:09 ` Randy Brukardt
2003-11-25 18:03 ` Jeffrey Carter
2003-11-25 18:31 ` Ekkehard Morgenstern
2003-11-26 0:42 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox