From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Visibility issue
Date: Fri, 11 Sep 2020 23:05:45 +0200 [thread overview]
Message-ID: <rjgor5$fhs$1@gioia.aioe.org> (raw)
In-Reply-To: db9dac7c-afe7-41ee-b395-fd1651768444n@googlegroups.com
On 11/09/2020 12:37, Daniel wrote:
> I want to use a tagged type as a link to communicate users of a library, in the way to make one part visible to them and also to hide some content that is only needed for the implementing of the library.
>
> Lets say i have the "Library" packages to expose things to users, and Implementing_Library packages to deal with the implementation:
>
> package Library.Users is
> type User_type is tagged with private;
> procedure foo_public (S: User_Type);
> private
> type User_Type is tagged with record
> hide_content_to_user : Natural;
> end record;
> function Access_to_hide_content return User_type;
Why is this a primitive operation? I would consider rather
function Access_to_hide_content return User_type'Class;
In presence of potential overriding things like these are usually
class-wide.
> So, are there more ways to see the hided content of this tagged type without extending the type itself in a child package? I needed to see this content outside of Library package.
You can also use aggregation:
type User_type is tagged with private;
private
type User_type is tagged with record
Implementation : Private_Stuff;
end record;
Private_Stuff may have its own hierarchy. This pattern works well with
limited types. You want the interface being non-limited, but the
implementation of limited in order to control/prevent excessive copying
and support in-place updates. So you make the interface a holder or a
smart pointer to the reference-counted implementation.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2020-09-11 21:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-11 10:37 Visibility issue Daniel
2020-09-11 11:51 ` Maxim Reznik
2020-09-11 20:11 ` Daniel
2020-09-11 14:23 ` Jeffrey R. Carter
2020-09-11 20:17 ` Daniel
2020-09-11 22:36 ` Jeffrey R. Carter
2020-09-14 10:47 ` Daniel
2020-09-14 16:10 ` Jeffrey R. Carter
2020-09-15 19:11 ` Daniel
2020-09-15 20:03 ` Jeffrey R. Carter
2020-09-11 21:05 ` Dmitry A. Kazakov [this message]
2020-09-14 11:33 ` Daniel
2020-09-14 14:42 ` Dmitry A. Kazakov
2020-09-15 19:35 ` Daniel
2020-09-16 7:14 ` Dmitry A. Kazakov
2020-09-16 10:23 ` Daniel
2020-09-16 10:58 ` Dmitry A. Kazakov
2020-09-16 14:35 ` Daniel
2020-09-16 14:49 ` Jeffrey R. Carter
2020-09-16 15:05 ` Dmitry A. Kazakov
2020-09-16 20:09 ` Daniel
2020-09-16 21:48 ` Simon Wright
2020-09-17 13:31 ` Daniel
2020-09-17 15:00 ` Dmitry A. Kazakov
2020-09-17 15:32 ` Daniel
2020-09-17 16:47 ` Dmitry A. Kazakov
2020-09-18 8:05 ` Simon Wright
2020-09-14 16:18 ` Simon Wright
2020-09-17 15:58 ` Jere
2020-09-17 16:10 ` Jere
2020-09-18 8:08 ` Simon Wright
2020-09-17 21:47 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox