comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: HELP: renames and enum values
Date: 2000/04/14
Date: 2000-04-14T19:52:59+00:00	[thread overview]
Message-ID: <38F7771A.8080F022@averstar.com> (raw)
In-Reply-To: 38F5D6F9.5B8892F2@bton.ac.uk

John English wrote:
> ...
> 
> What's even less obvious is the way to rename enumeration literals:
> 
>  function Enum_Literal return Enum_Type renames Other_Enum_Literal;
> 
> Now, that *really* confuses them, and none of them would ever be
> able to guess it without being told!

We sort of fixed this in Ada 95.  In Ada 83, if you did the
"obvious" thing:

   Enum_Literal : Enum_Type renames Other_Enum_Literal;

you got your hand slapped by the compiler because it is attempting
to rename a value as an object.  In Ada 95, the above is perfectly
legal, and I would expect most people to use it for renaming.

The only reason *not* to use the "obvious" renaming is if you
want the renaming itself to be overloadable.  That seems relatively
less common.  If you are sophisticated enough to want to have
your renamings overloadable, then you are probably sophisticated enough
to use function renamings to accomplish them.

So I would not consider this a teaching problem any more.
The beginning user can do the obvious thing, and the more
sophisticated user can get overloadability if they need it.

> 
> -----------------------------------------------------------------
>  John English              | mailto:je@brighton.ac.uk
>  Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
>  Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
>  University of Brighton    |    -- see http://burks.bton.ac.uk
> -----------------------------------------------------------------

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  parent reply	other threads:[~2000-04-14  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38ECE0EB.4BD4A53E@mindspring.com>
2000-04-07  0:00 ` HELP: renames and enum values Samuel T. Harris
2000-04-07  0:00   ` Al Johnston
2000-04-09  0:00     ` Robert Dewar
2000-04-09  0:00       ` dale
2000-04-09  0:00         ` Robert Dewar
2000-04-10  0:00           ` Dale Stanbrough
2000-04-13  0:00             ` John English
2000-04-13  0:00               ` Samuel T. Harris
2000-04-13  0:00               ` Robert Dewar
2000-04-14  0:00                 ` John English
2000-04-13  0:00               ` Ted Dennison
2000-04-13  0:00                 ` Robert A Duff
2000-04-13  0:00                 ` Samuel T. Harris
2000-04-14  0:00               ` Tucker Taft [this message]
2000-04-10  0:00       ` Samuel T. Harris
2000-04-11  0:00       ` Al Johnston
2000-04-10  0:00     ` Samuel T. Harris
2000-04-11  0:00       ` Al Johnston
2000-04-11  0:00 ` Tucker Taft
replies disabled

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