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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6433f675cae9b5bc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-27 13:16:08 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: RE: Allocate an array of a record with a discriminant? References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Tue, 27 Mar 2001 21:11:56 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 985727516 24.20.190.201 (Tue, 27 Mar 2001 13:11:56 PST) NNTP-Posting-Date: Tue, 27 Mar 2001 13:11:56 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:6139 Date: 2001-03-27T21:11:56+00:00 List-Id: Do you want to allocate an array of a record with a discriminant, or do you want to create and access a list of words? If the latter, you might do better to make a package with a spec along the lines of: Overflow : exception; -- Attempt to Add too many words, -- or too many characters of words. Nonesuch : exception; -- Attempt to Get non-existent ID. type Word_Counts is range 0 .. ??? subtype Word_Indices is Word_Counts range 1 .. Word_Counts'last; function Count return Word_Counts; -- return number of stored words. function Add(S : in Word) return Word_Indices; -- Add to store. Return new index. -- Raise Overflow if too many or too long words. function Get_Length(Index : in Word_Indices) return Natural; -- raise Nonesuch if no such word. function Get(Index : in Word_Indices) return Word; -- raise Nonesuch if no such word. ... anything else that's needed which can be easily implemented by storing the words as successive characters in a single big string, and using an array of start indices to let you quickly get the n-th word.