comp.lang.ada
 help / color / mirror / Atom feed
From: Reinert Korsnes <Reinert.Korsnes@ffi.no>
Subject: Question about enumeration types
Date: Tue, 24 Jul 2001 13:40:21 +0200
Date: 2001-07-24T13:40:21+02:00	[thread overview]
Message-ID: <3B5D5EA5.F20EC9D7@ffi.no> (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;




             reply	other threads:[~2001-07-24 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-24 11:40 Reinert Korsnes [this message]
2001-07-24 12:23 ` Question about enumeration types 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
replies disabled

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