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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c2d2708a248cb88 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Problem with packages Date: 1998/04/25 Message-ID: #1/1 X-Deja-AN: 347653472 Sender: news@inmet.camb.inmet.com (USENET news) References: <01bd706a$6007a540$db41a6c3@grat.softnet.co.uk> X-Nntp-Posting-Host: houdini.camb.inmet.com Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-04-25T00:00:00+00:00 List-Id: 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