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-Thread: 103376,30581de1aa7f8b46 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s72.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Discriminant within discriminants References: <1146620953.878484.308430@i40g2000cwc.googlegroups.com> In-Reply-To: <1146620953.878484.308430@i40g2000cwc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.176 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s72 1146674732 12.201.97.176 (Wed, 03 May 2006 16:45:32 GMT) NNTP-Posting-Date: Wed, 03 May 2006 16:45:32 GMT Date: Wed, 03 May 2006 16:45:33 GMT Xref: g2news2.google.com comp.lang.ada:4040 Date: 2006-05-03T16:45:33+00:00 List-Id: stuart clark wrote: > > package message_types > > type id_type is range 1..8; > > type dispense_ack (size:id_type:=id_Type'first) is > record > dispense_acks:array(1..size) of acks; > end record; > > type message_types(dispense_acknowledgement, dispense_request); Do you want an "is" in there before the '('? > type in_messages(kind :msg_types:=msg_types'first) is > record > case type is > when dispense_acknowledgement => > acknowledgements:dispense_ack; > when dispense_request > request:integer; > end case > end record; > > end message_types; > > i want to declare a message that is of dispense_acknowledgment type > with a size of 8 > > the only way i can get my code to compile with a message size of 8 is > to use > > declare > msg:message_types.in_messages; > dispense_ack_msg:message_types.dispense_ack(size=>8); > begin > msg:=(kind=>message_types.dispense_acknowledgement, > acknowledgements=>dispense_ack_msg); > > end; > > QUESTION : can i declare a message with a type and size in the one > statement without using the intermediate message. Msg : Message_Types.In_Messages := (Kind => Message_Types.Dispense_Acknowledgement, Acknowledgements => (Size => 8, Dispense_Acks => (1 .. 8 => Thing) ) ); This requires that a value of the (undefined) type Acks be available (Thing in the example). If you don't have such a value, then something along the lines of your example is required. Note that you can also do declare Msg : Message_Types.In_Messages (Kind => Message_Types.Dispense_Acknowledgement); DAM : Message_Types.Dispense_Ack (Size => 8); begin Msg.Acknowledgements := DAM; end; (Note also that most dictionaries recommend the spelling "acknowledgment".) -- Jeff Carter "I would never want to belong to any club that would have someone like me for a member." Annie Hall 41