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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32ba5f24e70f4e55,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-07 07:04:07 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!jussieu.fr!enst!enst.fr!not-for-mail From: Marius Amado Alves Newsgroups: comp.lang.ada Subject: accesing internal codes used for an enumeration Date: Mon, 7 May 2001 16:03:00 +0000 (GMT) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: avanie.enst.fr 989244246 94419 137.194.161.2 (7 May 2001 14:04:06 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 7 May 2001 14:04:06 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Sender: alves@lux38 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.3 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: newsfeed.google.com comp.lang.ada:7254 Date: 2001-05-07T16:03:00+00:00 I am trying to implement a lexicon (in the database sense) as an enumeration with a representation clause. Example lexicon: Name <-> Code ------------- Ping 123 Pong 456 Implementation: type Names is (Ping, Pong); for Names use (Ping => 123, Pong => 456); I found out the hardway that attribute Pos does not return the internal code. The ARM says this at 13.4(11), and tells you to use Unchecked_Conversion instead--but does not instruct you on the types of the conversion. Where might one learn that? Thanks. /* The point of a lexicon is to access its elements by either key. I expect the implementation above would be eficient. It is already simple to declare/define. The alternative is of course to use arrays, but then a search procedure is needed. I also wanted to avoid this complication. */ -- Marius Amado Alves alves@systran.lu Project Tradaut-Pt Systran Luxembourg 12, Rue de Vianden L-2680 LUXEMBOURG Tel 352 + 45 46 53 Fax 352 + 45 74 75 Mob 351 +939354002