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,ca20ac98709f9b4a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Array of Strings References: <0e021c61-535a-4935-95ad-2a241fa7302f@e53g2000hsa.googlegroups.com> In-Reply-To: <0e021c61-535a-4935-95ad-2a241fa7302f@e53g2000hsa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <2VaCk.356477$yE1.321489@attbi_s21> NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1222195902 12.201.97.213 (Tue, 23 Sep 2008 18:51:42 GMT) NNTP-Posting-Date: Tue, 23 Sep 2008 18:51:42 GMT Organization: AT&T ASP.att.net Date: Tue, 23 Sep 2008 18:51:42 GMT Xref: g2news2.google.com comp.lang.ada:7805 Date: 2008-09-23T18:51:42+00:00 List-Id: jedivaughn wrote: > If I wanted to make a package that made the array generic how would I > go about doing this. this is what I have which isn't working. > > generic > > type Element_Type is (<>); This specifies that the actual for Element_Type must a discrete type, as the error msg indicates. > type range1 is (<>); > > > package list is > type letters is private; > > private > type letters is array (range1) of Element_Type; > > end list; > > > and then in the main program I want > > subtype range2 is integer range 1..25; > subtype str_length is string (1..25); Presumably you want Element_Type to be private, which allows any non-limited type you can declare an object of without an initialization. I presume you're doing this to learn about generics, since what you have here doesn't do anything worthwhile. There is also a way to define your component type as an array type: generic -- List type Element_Component is private; type Element_Index is (<>); type Element is array (Element_Index) of Element_Component; type Letters_Index is (<>); package List is type Letters is private; private -- List type Letters is array (Letters_Index) of Element; end List; This is more restrictive than private. -- Jeff Carter "Sir Lancelot saves Sir Gallahad from almost certain temptation." Monty Python & the Holy Grail 69