comp.lang.ada
 help / color / mirror / Atom feed
* Question about enumeration types
@ 2001-07-24 11:40 Reinert Korsnes
  2001-07-24 12:23 ` Larry Hazel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Reinert Korsnes @ 2001-07-24 11:40 UTC (permalink / raw)


Hi,

(sorry for somehow repeating a question)

Given the program as below.  Here I did put "E : E1" inside
a record since "E" is also a possible value for the enumeration type E1.

This is somehow verbose.  Is it a more elegant way ?

I find it boring that extending the range of possible values of
an enumeration type may easily cause conflicts with variable names,
and new variable names may cause conflicts values for enumeration
types.  I sometimes would like to have the reserved word "Exit"
as a possible value of an enumeration type....  Am I thinking
somewhat wrong ?

reinert

with Text_IO;
use  Text_IO;
procedure Atest1 is
   type E1 is (A, B, C, D, E);
   package E1_Io is new Text_IO.Enumeration_Io (E1);
   use E1_Io;

-- this conflicts with "E" as a possible value for type "E1" -- E : E1;

   type ARec_t is
     record
       E : E1;
     end record;
   ARec : ARec_t;

   begin
    ARec.E := A;

    Put(E1'First);Put(" ");Put(E1'Last);
end Atest1;




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-07-31  9:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-24 11:40 Question about enumeration types Reinert Korsnes
2001-07-24 12:23 ` Larry Hazel
2001-07-24 12:31 ` Marc A. Criley
2001-07-26 16:52 ` Robert Dewar
2001-07-27 13:04   ` Ken Garlington
2001-07-31  9:59   ` Peter Hermann

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