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,CP1252 X-Google-Thread: 103376,338329c7567811e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-11 09:09:11 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!enst!enst.fr!not-for-mail From: "Robert C. Leif, Ph.D." Newsgroups: comp.lang.ada Subject: Extensible Enumerated Types Date: Sun, 11 Feb 2001 09:07:55 -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="Windows-1252" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 981911350 85285 137.194.161.2 (11 Feb 2001 17:09:10 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 11 Feb 2001 17:09:10 +0000 (UTC) To: "Comp. Lang. Ada" 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 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:5123 Date: 2001-02-11T09:07:55-08:00 From: Bob Leif To: Robert Dewar et al. Following your excellent suggestion, I have created, an" Informal comment on this International Standard". I have also employed FrameMaker to translate this into XML including creating a cascading style sheet. I would recommend storing all of these items in XML. I will gladly send the XML document and cascading style sheet to anyone. However, the FrameMaker export had to be edited and the equivalent of an Ada renames has to be found or created in XML for cascading style sheets. I would like to thank all of my fellow readers of Comp.Lang.Ada who came up with formats for extensible enumerated types, such as my second example. If you believe that you have a better suggestion than the 3 that I have listed, please post it and send it in (I guess) as an Informal comment on this International Standard". From: Annotated Ada Reference Manual (AARM) http://www.ada-auth.org/arm-html/RM-0-3.html Instructions for Comment Submission Informal comments on this International Standard may be sent via e-mail to ada-comment@ada-auth.org. If appropriate, the Project Editor will initiate the defect correction procedure. Comments should use the following format: ------------------------------------------------------------------- Topic: Extensible Enumerated Types Reference: RM95-3.5.1 (pp. 37) From: Robert C. Leif, Ph.D. Date: 01-02-11 Keywords: Extensible, Enumerated, Types, Supertypes 1. Discussion: 1.1 Introduction: The addition of child libraries facilitates programing by extension. The child, which evolves from the parent, can be either a supplement to or specialization of the parent. In any case the specification of the child should be limited to types and methods specific to the child. In the case of enumerated types, this approach is violated. Theoretically, the author of the software has to know in advance all of the values of the enumerated type. The child libraries would then specialize this type by employing subtypes. Another argument goes back to minimizing coupling and maximizing cohesion. For instance, the universe of name prefixes could easily exceed 100. For instance, in the case of Great Britain, all of the titles of nobility have to be added. The military and public officials would also have to be included. A simple example for this is a registration form for SIGAda. Since one of the best rules for data entry, is to minimize user entry of strings, pull-down menus with a list of choices are a good solution for the entry of enumerated types. However, the use of a menu with a list of 100 or more selections is highly user-hostile. Therefore a subtype will have to be used to populate the menu. Since it is extremely doubtful that a significant number of clergy or members of the nobility attend SIGAda, the number of items in the Name.Prefix menu can be reduced by neither including the prefixes for the clergy nor the nobility. It would be simpler to have the values for the clergy and nobility in separate child packages that can if need be withed. The parent package will have to be modified each time a prefix necessary for the child package has been discovered to have been omitted. It should be noted, that it is quite easy to omit, one or two items in an enumerated type. The flexibility of being able to add elements to an enumerated type will result in a smaller number of items being included in the original enumeration and simplify the creation of child packages. 2. Possible Approaches: type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev, Other); (1) supertype Army_Prefix_Type is (Prefix_Type, Private, Corporal, Sergeant, Lieutenant, Captain, Major, Colonel, General); (2) type Army_Prefix_Type is new Prefix_Type with (Private, Corporal, Sergeant, Lieutenant, Captain, Major, Colonel, General); (3) type Army_Prefix_Type is (Prefix_Type�range & ((Private, Corporal, Sergeant, Lieutenant, Captain, Major, Colonel, General)); Example (1) is expressive; however it requires a new keyword supertype, which is an antonym of subtype and thus provides symmetry. Example (2) uses the �is new� construct, which is severely overloaded. Example (3) uses the �&� operator and is analogous to string handling. --------------------------------------------------------------------------- Formal requests for interpretations and for reporting defects in this International Standard may be made in accordance with the ISO/IEC JTC1 Directives and the ISO/IEC JTC1/SC22 policy for interpretations. National Bodies may submit a Defect Report to ISO/IEC JTC1/SC22 for resolution under the JTC1 procedures. A response will be provided and, if appropriate, a Technical Corrigendum will be issued in accordance with the procedures.