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,a00ff2b882a06fda X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: HELP: renames and enum values Date: 2000/04/14 Message-ID: <38F7771A.8080F022@averstar.com>#1/1 X-Deja-AN: 611245439 Content-Transfer-Encoding: 7bit References: <38ECE0EB.4BD4A53E@mindspring.com> <38EE2019.4C91075D@Raytheon.com> <38EE494D.DDB9CE9@mindspring.com> <8cp1hd$3so$1@nnrp1.deja.com> <8cqf1i$i72$1@nnrp1.deja.com> <38F5D6F9.5B8892F2@bton.ac.uk> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@inmet2.burl.averstar.com X-Trace: inmet2.burl.averstar.com 955741979 3604 141.199.8.164 (14 Apr 2000 19:52:59 GMT) Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 NNTP-Posting-Date: 14 Apr 2000 19:52:59 GMT Newsgroups: comp.lang.ada Date: 2000-04-14T19:52:59+00:00 List-Id: 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