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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71dcb452eafb5045 X-Google-Attributes: gid103376,public From: jm59@prism.gatech.edu (John M. Mills) Subject: Re: Ada enumerations Date: 1997/12/10 Message-ID: <66n4vh$50s@acmex.gatech.edu>#1/1 X-Deja-AN: 297043668 References: <348EDDC9.794B@hso.link.com> Organization: Georgia Institute of Technology Newsgroups: comp.lang.ada Date: 1997-12-10T00:00:00+00:00 List-Id: "Stanley R. Allen" writes: >Matthew Heaney wrote: >> No, Ada doesn't come with an attribute to return the representation of an >> enumeration literal, because it doesn't need to! > At the risk of seeming shrill, I'll >repeat myself: what good reason can there be for >allowing me to *specify* enumeration representations >but denying me the ability to easily *query* them also? Interfacing to hardware (or to hardware simulated by software in some other language) may be made much more readable through enumerations named for the functions they perform ("Set_Mode( Op_Modes.Idle );") where the actual bit configurations for the controls are not at the disposition of the programmer. That _is_ a reason to explicitly assign; I don't claim it means you shouldn't be able to _query_ for representation. However there was a related thread in which a user complained about not being able to add an integer to an enumerate (and gave an example yielding a value which apparently was _not_ among the enumerate's defined representations). I see every reason to discourage that sort of code. This sounds about as risky as attempting to add pointers in C. -- John M. Mills, Senior Research Engineer -- john.m.mills@gtri.gatech.edu Georgia Tech Research Institute, Georgia Tech, Atlanta, GA 30332-0834 Phone contacts: 404.894.0151 (voice), 404.894.6258 (FAX) "Lies, Damned Lies, Statistics, and Simulations."