comp.lang.ada
 help / color / mirror / Atom feed
From: jm59@prism.gatech.edu (John M. Mills)
Subject: Re: Ada enumerations
Date: 1997/12/10
Date: 1997-12-10T00:00:00+00:00	[thread overview]
Message-ID: <66n4vh$50s@acmex.gatech.edu> (raw)
In-Reply-To: 348EDDC9.794B@hso.link.com


"Stanley R. Allen" <s_allen@hso.link.com> 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."




  reply	other threads:[~1997-12-10  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-10  0:00 Ada enumerations Stanley R. Allen
1997-12-10  0:00 ` John M. Mills [this message]
1997-12-10  0:00 ` Robert Dewar
1997-12-11  0:00   ` Mats Weber
1997-12-11  0:00     ` Robert Dewar
1997-12-12  0:00       ` Mats Weber
1997-12-12  0:00         ` Robert Dewar
1997-12-12  0:00     ` Samuel T. Harris
1997-12-11  0:00   ` Stanley R. Allen
1997-12-12  0:00     ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-12-03  0:00 Ada Enumerations Jeffrey Harris
1997-12-03  0:00 ` James S. Rogers
1997-12-03  0:00   ` Robert Dewar
1997-12-03  0:00     ` Stanley R. Allen
1997-12-04  0:00       ` Robert Dewar
1997-12-04  0:00         ` Stanley R. Allen
1997-12-18  0:00           ` Wes Groleau
1997-12-04  0:00       ` Matthew Heaney
1997-12-04  0:00         ` Stanley R. Allen
1997-12-07  0:00           ` Keith Thompson
1997-12-07  0:00             ` Matthew Heaney
1997-12-07  0:00             ` Robert Dewar
1997-12-08  0:00               ` Keith Thompson
1997-12-07  0:00                 ` Matthew Heaney
1997-12-11  0:00                   ` John G. Volan
1997-12-04  0:00 ` Stephen Leake
1997-12-04  0:00   ` Matthew Heaney
1997-12-04  0:00     ` Robert Dewar
1997-12-06  0:00       ` Jean-Pierre Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox