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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b5ab7c96b188b59e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-13 14:28:40 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: The "()" operator revisited. Date: Tue, 13 Jan 2004 16:27:36 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <1008s8nsn0u1ld6@corp.supernews.com> References: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:4377 Date: 2004-01-13T16:27:36-06:00 List-Id: "Frank J. Lhota" wrote in message news:MfVMb.11867$Qq.262@nwrdny01.gnilink.net... >...It would be nice if we could define "()" and "():=" for this hash > table so that we could write something like this: > > declare > Rec : Employee_Record_Hash_Table; > begin > ... > Rec( "Johnson" ) := This_Rec; > Display( The_Rec => Rec( "Smith" ) ); > ... > end; This seems like a lot of work to eliminate a few characters. I contend that virtually all ADTs ought to be controlled (meaning that their tagged). Presuming that, you can use prefix notation in Ada 200Y (see AI-252). Thus, if you have: function Element (Container : in Map_Type; Index : in Index_Type) return Element_Type; type Element_Handle is access all Element; function Set (Container : in Map_Type; Index : in Index_Type) return Element_Handle; your example would look like: declare Rec : Employee_Record_Hash_Table; begin ... Rec.Set( "Johnson" ).all := This_Rec; Display( The_Rec => Rec.Element( "Smith" ) ); ... end; Not perfect, but quite a bit closer than we can get in Ada 95. (Of course, if you chose short enough names, you can cut the characters used a lot more...) Randy.