From: Jere <jhb.chat@gmail.com>
Subject: Re: Full view of a private partial view cannot be a subtype
Date: Sun, 3 Dec 2017 05:33:15 -0800 (PST)
Date: 2017-12-03T05:33:15-08:00 [thread overview]
Message-ID: <889a3aed-4e6b-49c8-8c1c-6f1478e8e077@googlegroups.com> (raw)
In-Reply-To: <p00p3c$o7s$1@dont-email.me>
On Sunday, December 3, 2017 at 7:01:50 AM UTC-5, Jeffrey R. Carter wrote:
> On 12/03/2017 03:14 AM, Jere wrote:
> >
> > package New_Type1 is
> > subtype Instance is Base.Instance;
> > procedure Operation(Object : in out Instance);
> > private
> > procedure Operation(Object : in out Instance) renames Base.Operation;
>
> You can make the renaming visible as well. There doesn't seem to be any reason
> to hide the fact that Operation is a renaming of Base.Operation.
Yes. Sorry about that. In my haste to covert what I had to a reduced example
I forgot to make it null in the visible part. I would normally only hide that
for private types.
>
> > I'm also not
> > sure the semantics between the method I wanted and the
> > method I had to use are the same (in all situations).
>
> No, with a direct renaming, a call to the renaming is the same as a call to the
> original procedure. With a wrapper around the call to the original procedure,
> you have 2 calls. If you inline the wrapper then they should be equivalent.
I thought I remembered reading in the RM somewhere that if a renaming was a
completion, that it was equivalent to a wrapper, but to be honest my memory
isn't great. And even if I remembered correctly, I may not have understood
the context of that fully.
>
> > 1. Is there a way to make the full view of a private type
> > a subtype when the partial view is not a subtype? Or am
> > I forced to derive a new type?
>
> You cannot use a subtype to complete a private type. But you're not forced to
> use a derived type and convert all over the place. Another option is
>
> private
> type T is [tagged] [limited] record
> V : Base.T;
> end record;
>
> and then refer to Object.V with no conversions.
>
Thanks! I didn't even think about nesting it like that. That'll work.
next prev parent reply other threads:[~2017-12-03 13:33 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-03 2:14 Full view of a private partial view cannot be a subtype Jere
2017-12-03 12:01 ` Jeffrey R. Carter
2017-12-03 13:33 ` Jere [this message]
2017-12-03 14:34 ` Jeffrey R. Carter
2017-12-03 17:44 ` Robert Eachus
2017-12-03 18:50 ` Simon Wright
2017-12-03 22:10 ` Robert Eachus
2017-12-03 19:03 ` Jeffrey R. Carter
2017-12-03 22:23 ` Jere
2017-12-04 8:25 ` Dmitry A. Kazakov
2017-12-04 18:04 ` Jeffrey R. Carter
2017-12-04 20:41 ` Jere
2017-12-04 21:48 ` Jeffrey R. Carter
2017-12-05 8:20 ` Dmitry A. Kazakov
2017-12-05 18:16 ` Jeffrey R. Carter
2017-12-05 20:39 ` Dmitry A. Kazakov
2017-12-05 21:38 ` Jeffrey R. Carter
2017-12-05 12:35 ` Jere
2017-12-05 18:40 ` Jeffrey R. Carter
2017-12-06 12:54 ` Jere
2017-12-06 18:03 ` Jeffrey R. Carter
2017-12-05 20:22 ` Randy Brukardt
2017-12-05 15:27 ` Shark8
2017-12-05 18:50 ` Jeffrey R. Carter
2017-12-05 20:59 ` Randy Brukardt
2017-12-05 22:43 ` Shark8
2017-12-07 0:52 ` Randy Brukardt
2017-12-05 20:16 ` Randy Brukardt
2017-12-05 21:29 ` Jeffrey R. Carter
2017-12-07 0:04 ` Randy Brukardt
2017-12-04 20:49 ` Randy Brukardt
2017-12-05 12:56 ` Jere
2017-12-05 20:12 ` Randy Brukardt
2017-12-17 15:26 ` Jere
2017-12-17 15:39 ` Dmitry A. Kazakov
2017-12-18 22:47 ` Randy Brukardt
2017-12-19 1:22 ` Jere
2017-12-19 23:16 ` Randy Brukardt
2017-12-19 1:01 ` Jere
2017-12-19 9:08 ` Dmitry A. Kazakov
2017-12-19 13:08 ` Jere
2017-12-19 13:27 ` Dmitry A. Kazakov
2017-12-19 19:10 ` Stephen Leake
2017-12-18 20:45 ` Stephen Leake
2017-12-18 22:54 ` Randy Brukardt
2017-12-19 1:08 ` Jere
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox