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,FREEMAIL_FROM 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-02-02 14:02:00 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!newscore.gigabell.net!fu-berlin.de!uni-berlin.de!ppp-4-43.5800-6.access.uk.worldonline.COM!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: Extensible Enummerated types FW: When will next Ada revision be? (83, 95, ?) Date: Fri, 2 Feb 2001 21:54:39 -0000 Message-ID: <95fao3$h0g97$2@ID-25716.news.dfncis.de> References: NNTP-Posting-Host: ppp-4-43.5800-6.access.uk.worldonline.com (62.64.156.43) X-Trace: fu-berlin.de 981151300 17842471 62.64.156.43 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: supernews.google.com comp.lang.ada:4877 Date: 2001-02-02T21:54:39+00:00 List-Id: Robert Leif's example seems to lead to a slightly hairier alternative (to the simple proposal I made, unwittingly on behalf of Jeff Carter apparently). Here, an enumerated type declaration, either a standard one, e.g.: type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev); or a special one, e.g.: type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev) with others; declares a type which actually has more values (e.g. 256 or 65536) than are specified. A size representation clause could be used to ensure a big enough number are available. The first named subtype Prefix_Type denotes only the declared values, as if the following had been declared: type {anon} is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev); subtype Prefix_Type is {anon} range None..Rev; so most things work as for current Ada. The other values have no designators (but, I suppose, can still be referenced by using Val). A special kind of declaration can then declare identifiers (or character literals) for these values (starting at the first vacant position), e.g.: subtype New_Prefix_Type is Prefix_Type with (Guru, Ustad); The new subtype New_Prefix_Type denotes the full new range None..Ustad. Note how this allows multiple names to be declared for the same values: subtype My_Prefix_Type is Prefix_Type with (Master, Maestro); It may be that an enumeration representation clause must be disallowed for this kind of enumeration type. It may also be that the [Wide_]Image and [Wide_]Value attributes must also be disallowed for such a type and any of its subtypes. Anyone saluting this alternative? -- Nick Roberts http://www.AdaOS.org