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 X-Google-Thread: 103376,7b668a769fbfcee0 X-Google-Attributes: gid103376,public From: Philip Anderson Subject: Re: array(enumeration) Date: 2000/07/20 Message-ID: <3977160A.B0C6AD2E@amsjv.com>#1/1 X-Deja-AN: 648635739 Content-Transfer-Encoding: 8bit References: X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Trace: 20 Jul 2000 16:01:02 GMT, 141.196.71.191 Organization: Alenia Marconi Systems ISD MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-07-20T00:00:00+00:00 List-Id: Mario Amado Alves wrote: > > How do I define an array type indexed by an enumeration type? > > type Array_Type is array(<>) of Some_Type; > -- /|\ > -- | > -- compiler says identifier expected here Yes, you need to fully define the type, including the type of the index. > type Enumeration_Type is (A, B, C); > type Another_Enumeration_Type is (X, Y, Z); > > A_Thing: Array_Type(Enumeration_Type) := ( > A => ... , > B => ... , > C => ... ); > > Another_Thing: Array_Type(Another_Emuneration_Type) := ( > X => ... , > Y => ... , > Z => ... ); > > This makes sense to me, but does not compile. So how do I code the idea? type Array_Type is array (Enumeration_Type) of Some_Type; type Another_Array_Type is array (Another_Enumeration_Type) of Some_Type; A_Thing: Array_Type := ( A => ... , B => ... , C => ... ); Another_Thing: Another_Array_Type := ( X => ... , Y => ... , Z => ... ); Note that these objects are of different types, and cannot be assigned to each other even though the item type is the same. or simply: A_Thing : array (Enumeration_Type) of Some_Type := ( -- hwyl/cheers, Philip Anderson Alenia Marconi Systems Cwmbr�n, Cymru/Wales