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-7-bit X-Google-Thread: 103376,94b44ecb42c031b9 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: Searching for an object Date: 2000/08/22 Message-ID: #1/1 X-Deja-AN: 661242148 References: <87vgwte9yo.fsf@moon.mteege.de> X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 966971053 24.20.190.201 (Tue, 22 Aug 2000 12:04:13 PDT) Organization: @Home Network NNTP-Posting-Date: Tue, 22 Aug 2000 12:04:13 PDT Newsgroups: comp.lang.ada Date: 2000-08-22T00:00:00+00:00 List-Id: I presume you couldn't do Lastname : array(1 .. N) of String(1 .. 10); Firstname : array(1 .. N) of String(1 .. 10); and have separate Find_xxx routines for the different fields Find_Lastname("Matthias "); -- not found Find_Lastname("Teege "); -- found thus making the caller of Find_xxx make the "which field" decision. If a single Find routine needs to make a decision based on the particular desired field, then at some level you really do need what amounts to a set of "if"s or a "case" statement. If you can use a subscript and index, then the hardware that decides which RAM address you're accessing can make the decision, eg type fields is (lastname, firstname); subtype names is string(1 .. 10); type name_parts is array(fields) of names; type Customer is record name_part : name_parts; other_info: other_types; end record Cust : Customer; Cust.name_part(lastname) = "Teege "; Cust.name_part(firstname)= "Matthias "; Find(lastname, "Matthias "); -- not found Find(lastname, "Teege "); -- found If you can't do that, you could get the compiler to generate an implicit "case" by using tagged types and dispatching to a particular Find depending on the field, but that might be overkill.