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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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-20 08:18:31 PST Path: supernews.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Jeff Creem" Newsgroups: comp.lang.ada Subject: Re: Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Date: Sat, 20 Jan 2001 11:19:59 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <94c61v$h4a$1@nnrp1.deja.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Complaints-To: newsabuse@supernews.com Xref: supernews.google.com comp.lang.ada:4236 Date: 2001-01-20T11:19:59-05:00 List-Id: "Robert Dewar" wrote in message news:94c61v$h4a$1@nnrp1.deja.com... > In article , > comp.lang.ada@ada.eu.org wrote: > > From: Bob Leif > > To: Tucker Taft et al. > > > I believe that at one time you mentioned the possibility of > > extending an enumerated type. This would greatly facilitate > > object oriented programming. > > We did indeed consider this possibility, and I even think it > was in one of the earlier mapping documents, but it was > excluded because the implementation and description > difficulties outweighed the usefullness, and further more > for the specific examples presented, there seemed to be > perfectly acceptable alternative methods of doing things. > > There is quite a bit of semantic structure in Ada that depends > on knowing the possible set of enumeration types statically. Of course I would find it useful (at times) to be able to extend the set of an enumeration type (in a new derived type) even without having some sort of a class based pointer to an arbitrary version of one of the new types. There are of course other perfectly acceptable methods but at times it would be cleaner to be able to do things like type Fruit_Type is (Apple, Orange); type New_Fruit_Type is new Fruit_Type with (Pear, Kiwi); A : Fruit_Type := Apple; B : New_Fruit_Type := New_Fruit_Type(A); In the past when I have ran into situations like this (where for very specific reasons I could not add anything to Fruit_Type) I have resorted to enumeration indexed arrays of enumeration type look-up tables for the conversion...Not bad but not as clean as the above. Whether the extra complexity this imposes on compiler writes (or language learners) is worth the occasional convenience is certainly debatable.