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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fa22a73e140a6fd1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.117.197 with SMTP id kg5mr9353314pbb.5.1326153516515; Mon, 09 Jan 2012 15:58:36 -0800 (PST) Path: lh20ni161633pbb.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!news.internetdienste.de!noris.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 10 Jan 2012 00:58:39 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; en-US; rv:1.9.2.25) Gecko/20111213 Thunderbird/3.1.17 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Object-Oriented style question References: <4f098fcb$0$6577$9b4e6d93@newsspool3.arcor-online.net> <11047e9f-a7ef-4728-8e1c-4202c5958e9c@ck5g2000vbb.googlegroups.com> In-Reply-To: <11047e9f-a7ef-4728-8e1c-4202c5958e9c@ck5g2000vbb.googlegroups.com> Message-ID: <4f0b7f2b$0$7617$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 10 Jan 2012 00:58:35 CET NNTP-Posting-Host: c04233bf.newsspool1.arcor-online.net X-Trace: DXC=2`67V1QF0Oh016@cHD@m;jic==]BZ:afn4Fo<]lROoRa<`=YMgDjhgbZ4`Yna[0]:nPCY\c7>ejVhYUcQ_Y3?jUa2Whm`O;Kc:o X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-01-10T00:58:35+01:00 List-Id: On 1/9/12 9:55 AM, Maciej Sobczak wrote: > But I think that in one particular case you might want to distinguish > between these profiles - access value is a "name" of the object, not > the object itself, and therefore can be used for more involved lookup. > Like in a dictionary, where access values are lightweight keys. > Then, the real meaning of Info_3 would be "tell me what you know about > the object whose name is this-or-that", using perhaps multiple > dictionaries (or should I say "caches"?) or complicating this idea in > any other way you like. Wouldn't the following lookup function handle the situation? function Lookup (Table : Dictionaries.Map; Object : T'Class) return Boolean is begin return Table.Contains (Object'Unchecked_Access); end Lookup; Object denotes an object, then, so no nulls. Therefore, passing the result of 'Unchecked_Access to function "Contains" should be safe in the sense that Contains always gets a meaningful access value to be used as a key. The effect is that there still wouldn't be any parameters of an anonymous access-to-object type at the level of T's definition.