comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado Alves <alves@systran.lu>
To: comp.lang.ada@ada.eu.org
Subject: accesing internal codes used for an enumeration
Date: Mon, 7 May 2001 16:03:00 +0000 (GMT)
Date: 2001-05-07T16:03:00+00:00	[thread overview]
Message-ID: <mailman.989244246.26083.comp.lang.ada@ada.eu.org> (raw)

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





             reply	other threads:[~2001-05-07 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-07 16:03 Marius Amado Alves [this message]
2001-05-07 15:33 ` accesing internal codes used for an enumeration Jacob Sparre Andersen
2001-05-07 15:54 ` Ted Dennison
2001-05-08  3:51 ` Marc A. Criley
  -- strict thread matches above, loose matches on Subject: below --
2001-05-07 18:53 Beard, Frank
2001-05-08  5:56 ` Jacob Sparre Andersen
     [not found] <Pine.LNX.4.21.0105071543050.9145-100000@lux38>
2001-05-07 21:18 ` Marius Amado Alves
2001-05-10 18:45 Beard, Frank
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox