comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm-host.bauhaus@maps.futureapps.de>
Subject: Re: Object-Oriented style question
Date: Tue, 10 Jan 2012 00:58:39 +0100
Date: 2012-01-10T00:58:35+01:00	[thread overview]
Message-ID: <4f0b7f2b$0$7617$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <11047e9f-a7ef-4728-8e1c-4202c5958e9c@ck5g2000vbb.googlegroups.com>

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.



  reply	other threads:[~2012-01-09 23:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 12:45 Object-Oriented style question Georg Bauhaus
2012-01-08 12:52 ` Simon Wright
2012-01-08 13:25   ` Dmitry A. Kazakov
2012-01-08 14:18 ` Robert A Duff
2012-01-08 20:32   ` Martin Dowie
2012-01-08 20:52     ` Robert A Duff
2012-01-09 22:34   ` Adam Beneschan
2012-01-09 23:21     ` Robert A Duff
2012-01-10  8:34     ` Dmitry A. Kazakov
2012-01-09  8:55 ` Maciej Sobczak
2012-01-09 23:58   ` Georg Bauhaus [this message]
2012-01-10  8:47     ` Maciej Sobczak
2012-01-10 10:27       ` Dmitry A. Kazakov
2012-01-10 12:27       ` Georg Bauhaus
2012-01-11  8:54         ` Maciej Sobczak
2012-01-10 21:26       ` Randy Brukardt
2012-02-08 12:23 ` Yannick Duchêne (Hibou57)
2012-02-08 12:39 ` Yannick Duchêne (Hibou57)
replies disabled

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