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,c3a7c1845ec5caf9 X-Google-Attributes: gid103376,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: Equality operator overloading in ADA 83 Date: 1997/04/28 Message-ID: <5k2081$oms@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 237889781 References: <01bc4e9b$ac0e7fa0$72041dc2@lightning> <335F5971.6375@elca-matrix.ch> <5jvlt7$54b@mulga.cs.mu.OZ.AU> Organization: Comp Sci, University of Melbourne Newsgroups: comp.lang.ada Date: 1997-04-28T00:00:00+00:00 List-Id: dewar@merv.cs.nyu.edu (Robert Dewar) writes: >Fergus said > ><string case statements [...] >I leave it to the reader to judge what conclusions should be >drawn from this data.>> > >Interesting: I really can't see any utility in this feature in a compiler >so it is a surprise to me that it is used in any compiler ... Usually >you want to do all string recognizion in the context of a general names >table that includes user defined words as well as system words. Fergus >can you give a hint of typical example of how this is used. In examples in the Mercury compiler, the strings involved are - the names of operators - the names of procedures for which the compiler generates inline code - names to special-case when doing name mangling ... Some examples I see use Mercury predicates as small in-memory read-only relational databases; for example: % areas in 1000s of square miles :- pred area(string, int). :- mode area(in, out). area("china", 3380). area("india", 1139). area("ussr", 8708). area("usa", 3609). area("indonesia", 570). area("japan", 148). ... I suppose in Ada you could handle these sorts of examples by declaring a constant array of records, making sure that the array was sorted, and using binary search. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.