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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c5fe2cecfab19751 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-13 04:43:35 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.stueberl.de!news-mue1.dfn.de!news-ber1.dfn.de!news.uni-hamburg.de!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: limited types in libraries Date: Sat, 13 Dec 2003 12:43:34 +0000 (UTC) Organization: GMUGHDU Message-ID: References: NNTP-Posting-Host: l1-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1071319414 5784 134.91.1.34 (13 Dec 2003 12:43:34 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Sat, 13 Dec 2003 12:43:34 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/800)) Xref: archiver1.google.com comp.lang.ada:3434 Date: 2003-12-13T12:43:34+00:00 List-Id: ada_wizard@toadmail.com wrote: : Hmm. I can't see why it would ever be ok to implement "=" and "<" in a : non-consistent way. Certainly any subprograms provided by the user : must meet the container's requirements. Yes, but there might be different requirements in other parts of a program, which let the programmer _think_ that "=" and "<" are consistent. A database's records of persons' addresses might be sorted by surname, for example. Suppose name(r) returns a Wide_String or similar for the surname in a record. Then one record is sorted before another by function "<" (k1, k2: DB_Record) return Boolean is begin return name(k1) < name(k2); end "<"; (and similarly for ">"). However, two records indicate the same person if they show the same name and phone number, function "=" (k1, k2: DB_Record) return Boolean is begin return name(k1) = name(k2) and phone(k1) = phone(k2); end "="; Then it might be that for j /= 0, not dbrec(n) < dbrec(n + j) and not dbrec(n) > dbrec(n + j) but still not dbrec(n) = dbrec(n + j) and this might make sense from the point of view of database records. So I might have to change my point of view so that I can see the requirements of the containers or sorting related algorithms, and understand, in some details, when "=" and "<" will come into play. (But I might just be confused.) -- Georg