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,5b0235b23a9db0f2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-28 00:14:02 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!enst!enst.fr!not-for-mail From: "Robert C. Leif, Ph.D." Newsgroups: comp.lang.ada Subject: RE: Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Date: Sun, 28 Jan 2001 00:10:54 -0800 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="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 980669546 42479 137.194.161.2 (28 Jan 2001 08:12:26 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 28 Jan 2001 08:12:26 +0000 (UTC) To: Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <94hi1m$jl1$1@nnrp1.deja.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0 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: supernews.google.com comp.lang.ada:4629 Date: 2001-01-28T00:10:54-08:00 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 , 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/