From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 12 Jul 91 22:17:57 GMT From: munnari.oz.au!ariel!ucsvc.ucs.unimelb.edu.au!phillip.edu.au!x01233@uunet. uu.net Subject: Discriminants & limited privates - yuk? Message-ID: <1991Jul12.171757.10257@phillip.edu.au> List-Id: Hello. I have a question - just HOW do i assign a value to a record with a discriminant and a limited private component? As I wish to set the value of the discriminant I have to use an aggregate(?), which requires specifying values for all the components. The catch is that one component is limited private, and they can't appear in aggregates, can they? The procedure set (see below) must decide the value of the discriminant (preferably the parameter would be an 'out' parameter,but that's a no-no) so its not acceptable to say that the discriminant should already have the required value. Code that won't compile shown below... --------------------------------------------------------------------------- -- define a limited private type and constant. package lp is type blob is limited private; jelly :constant blob; private type blob is new integer; jelly :constant blob:=42; end lp; --------------------------------------------------------------- with lp; use lp; procedure test is type enum_type is (a,b,c); type discriminant_record(discriminant:enum_type:=a) is record case discriminant is when a=> item :blob; when others=> null; end case; end record; item :discriminant_record; --------------------------------------------------------------- procedure set( value :in out discriminant_record) is begin value:=(a,jelly); ^^^^^^^^ Of course assignment is not available for limited private types, so this is a no-no, but just how does 'value' get a value? end; begin set(item); end; ------------------------------------------------------------------------------ Thanks in advance... Dale. ------------------------------------------------------------------------ Dale Stanbrough | Phillip Institute of Technology | Melbourne, Australia | | dale@phillip.edu.au |