From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Publishing selected entries in a protected object?
Date: Thu, 9 Feb 2012 14:42:19 +0100
Date: 2012-02-09T14:42:19+01:00 [thread overview]
Message-ID: <1aa4khpoo56jh$.7pxzenl1ikpa.dlg@40tude.net> (raw)
In-Reply-To: 87wr7wkyp5.fsf@adaheads.sparre-andersen.dk
On Thu, 09 Feb 2012 12:56:06 +0100, Jacob Sparre Andersen wrote:
> I have a package containing a protected object, and I would like to
> publish _one_ of this object's entries in the specification of the
> package.
>
> Since I want to be able to use the entry in a select statement, I can't
> just encapsulate it in a procedure and make that available in the
> package specification.
>
> And if I move the declaration of the protected object to the package
> specification, but move the other entries to the private part of the
> protected object, I can't access the other entries from the private part
> of my package.
>
> Is there a pattern I can use?
Not exactly, but ...
type I is protected interface;
procedure A (X : in out I) is abstract;
protected type Foo is new I with
overriding entry A; -- "Public entry"
entry B; -- "Private entry"
end Foo;
Now, if only the interface I is visible, then that would be close to what
you wanted.
P.S. Alas, but the following is illegal:
[protected] type Foo is new I with private;
private
protected type Foo is new I with ... end Foo;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2012-02-09 13:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 11:56 Publishing selected entries in a protected object? Jacob Sparre Andersen
2012-02-09 13:42 ` Dmitry A. Kazakov [this message]
2012-02-09 13:59 ` Georg Bauhaus
2012-02-09 18:24 ` AdaMagica
2012-02-10 1:29 ` Randy Brukardt
2012-02-09 19:29 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox