comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Problem with packages
Date: 1998/04/25
Date: 1998-04-25T00:00:00+00:00	[thread overview]
Message-ID: <ErzMGt.64t.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 01bd706a$6007a540$db41a6c3@grat.softnet.co.uk


Sean kenny (skenny@gifford.co.uk) wrote:

: can anyone tell us why this the following code won't compile
: we keep the following error message 

:  invalid prefix in selected component "working_hold"

: on the indicated lines

: hold_id is defined in the following package which compiles
: ok.

The problem is that hold_id is a private type.
You haven't exported any operations on hold_id, other than "request_work."
If you want next_container and complete to be performed on hold_id,
you will need to declare them in the visible part of "foreman."

You could declare them as "regular" procedures in the visible
part, with an extra "hold_id" formal parameter, and then implement
them in the body of package "foreman" by calling the corresponding
entry of the task type "hold."  You could use a pragma Inline
on these "wrapper" procedures if the extra procedure call overhead
is a serious problem (seems unlikely in this case).

: WITH foreman;
: use foreman;

: PACKAGE BODY gangs IS
: TASK body gang is
:   hold_state : work := more;
:   working_hold: hold_id;
: begin
:   foreman.request_work(working_hold);
:   WHILE hold_state = more loop
:   working_hold.next_container(hold_state);      <----
:   END loop;
:         
:   working_hold.complete;        <------

: end gang;

: END gangs;



: package foreman is

: type work is (more, finished);
: type hold_id is limited private;

: procedure request_work(this_hold : in out hold_id);
: private
: type hold;
: type hold_id is access hold;
: task type hold is
:  entry next_container(state : out work);
:  entry complete;
: end hold;
: end foreman;-- 

: ----------------------------------------------------------------------------
: -------------------
: You've received this mail from one of the Kenny
: -Irvine clan, it could have been Sean, Hilary,
: Eileen(10),Joe(9) or Neave (6mths).
: If you want to mail us its skenny@gifford.co.uk

: or

: skenny@csm.uwe.ac.uk

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




       reply	other threads:[~1998-04-25  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk>
1998-04-25  0:00 ` Tucker Taft [this message]
1998-04-27  0:00 ` Problem with packages Samuel Mize
1998-04-27  0:00 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox