comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert C. Leif, Ph.D." <rleif@rleif.com>
To: <comp.lang.ada@ada.eu.org>
Subject: RE: Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?)
Date: Sun, 28 Jan 2001 00:10:54 -0800
Date: 2001-01-28T00:10:54-08:00	[thread overview]
Message-ID: <mailman.980669544.10667.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <94hi1m$jl1$1@nnrp1.deja.com>

From: Bob Leif
To: Ted Dennison et al.

There actually is a class 'tag in the program. Unfortunately, it does NOT
solve the problem.
----------------------------------------
with Ada.Text_Io;
generic
   type Enum_Type is (<>);
   type Info_Type is private;
package Generic_Rec_W_Enum_Part_Pkg is
   type Enum_Rec_Type is tagged record
      Enum_Part : Enum_Type;
      Info_Part : Info_Type;
   end record;

--This is instantiated

type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev,
    Other);

package Prefix_Recs is new Generic_Rec_W_Enum_Part_Pkg
    (Enum_Type => Prefix_Type,
    Info_Type => Prefix_Bd_Type); --15 character bounded_string.

subtype Prefix_Rec_Type is Prefix_Recs.Enum_Rec_Type;

None_Rec : constant Prefix_Rec_Type := (None, Null_Prefix_Suffix_Bd);
  Mr_Rec   : constant Prefix_Rec_Type := (Mr,To_Bd("Mr."));
  Ms_Rec   : constant Prefix_Rec_Type := (Ms,To_Bd("Ms."));
  Miss_Rec : constant Prefix_Rec_Type := (Miss,To_Bd("Miss"));
  Mrs_Rec  : constant Prefix_Rec_Type := (Mrs,To_Bd("Mrs."));
  Dr_Rec   : constant Prefix_Rec_Type := (Dr,To_Bd("Dr."));
  Prof_Rec : constant Prefix_Rec_Type := (Prof,To_Bd("Prof."));
  Rev_Rec  : constant Prefix_Rec_Type := (Rev,To_Bd("Rev."));
  Other_Rec : Prefix_Rec_Type := (Enum_Part => Other,
    Info_Part => To_Bd("Other"));

The addition of a new type (field) to Prefix_Rec_Type does not permit
addition of new objects of Prefix_Rec_Type; because, Prefix_Rec_Type is
limited by the number of items in the enumerated type Prefix_Type.

The only obvious way to solve this problem is to permit the extension of
Prefix_Type by the addition of new enumerated values. I had to circumvent
the enumeration by including "Other". The use of Other significantly
decreases the capacity of monitoring membership in the set of an enumerated
type. Although my suggestion will require effort on the part of compiler
vendors, I believe that it will aid the programmers.

-----Original Message-----
From: comp.lang.ada-admin@ada.eu.org
[mailto:comp.lang.ada-admin@ada.eu.org]On Behalf Of Ted Dennison
Sent: Monday, January 22, 2001 7:02 AM
To: comp.lang.ada@ada.eu.org
Subject: Re: Extensible Enummerated types FW: When will next Ada
revision be? (83, 95, ?)


In article <mailman.979975693.13263.comp.lang.ada@ada.eu.org>,
  comp.lang.ada@ada.eu.org wrote:
> I believe that at one time you mentioned the possibility of extending
> an enumerated type. This would greatly facilitate object oriented
> programming. For instance, I have created a Person_Names package. The

Why can't you use the class' tag for that purpose?

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/





  reply	other threads:[~2001-01-28  8:10 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-20  7:26 Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Robert C. Leif, Ph.D.
2001-01-20 14:06 ` Robert Dewar
2001-01-20 16:19   ` Jeff Creem
2001-01-20 16:23     ` Mark Carroll
2001-01-20 19:18       ` Robert Dewar
2001-01-20 22:27         ` Brian Rogoff
2001-01-21 16:06           ` Robert Dewar
2001-01-21 23:08             ` Brian Rogoff
2001-01-22  2:02               ` Robert Dewar
2001-01-22 16:02                 ` Brian Rogoff
2001-01-22 16:50                   ` Robert Dewar
2001-01-22 21:12                     ` Brian Rogoff
2001-01-22 21:26                       ` Jean-Pierre Rosen
     [not found]                         ` <Pine.BSF.4.21.0101230839000.15065-100000@shell5.ba.best.com>
     [not found]                           ` <94rbdo$vf$1@wanadoo.fr>
2001-01-26 16:41                             ` LOF4 (Was Re: Extensible Enummerated types) Brian Rogoff
2001-01-20 22:34         ` Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Mark Carroll
2001-01-21 16:09           ` Robert Dewar
2001-01-21 19:04             ` Mark Carroll
2001-01-21 19:26               ` Robert Dewar
2001-01-21 21:12                 ` Mark Carroll
2001-01-21 17:47     ` Nick Roberts
2001-01-21 19:37       ` Robert Dewar
2001-01-22 17:26         ` Mark Lundquist
2001-01-22 20:47           ` Randy Brukardt
2001-01-22 21:41             ` Matthew Woodcraft
2001-01-30 16:17           ` Tucker Taft
2001-01-31  8:05             ` Extensible Enumerated " Robert C. Leif, Ph.D.
2001-02-10 20:34               ` Vincent Marciante
2001-01-31  8:05             ` Supertypes RE: Extensible Enumerated types Robert C. Leif, Ph.D.
2001-01-31 15:15               ` Marin David Condic
2001-02-01 22:03             ` Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Nick Roberts
2001-02-02  3:48               ` Robert Dewar
2001-02-02  4:41                 ` Jeffrey Carter
2001-02-02  7:26                   ` Robert C. Leif, Ph.D.
2001-02-02 16:38                     ` Robert Dewar
2001-02-02 20:39                     ` (Private message. Sorry) Nick Roberts
2001-01-22 15:02 ` Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Ted Dennison
2001-01-28  8:10   ` Robert C. Leif, Ph.D. [this message]
2001-02-02 21:54     ` Nick Roberts
replies disabled

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