From: Jere <jhb.chat@gmail.com>
Subject: Re: Preventing private procedure visibility being made public through extension
Date: Sun, 21 May 2017 14:45:46 -0700 (PDT)
Date: 2017-05-21T14:45:46-07:00 [thread overview]
Message-ID: <1944a768-c92a-4f69-80b9-e79be32d037b@googlegroups.com> (raw)
In-Reply-To: <oft0b1$196q$1@gioia.aioe.org>
On Sunday, May 21, 2017 at 5:20:36 PM UTC-4, Dmitry A. Kazakov wrote:
> On 2017-05-21 22:21, Jere wrote:
>
> > The actual use case has
> > them in separate packages, but the problem is the same:
>
> No. Robert meant that when you declare a subprogram in a separate
> package [more precisely after the type's freezing point] it will not
> become a primitive operation. A non-primitive operation is simply not
> inherited and if not visible, is gone. Being not inherited is a very
> important point, it will be rejected for derived types even if visible.
> Consider this:
>
> package Base is
> type Base_Type is tagged null record;
> end Base;
>
> package Base_Something is
> procedure Something (X : in out Base_Type; Y : Integer) is null;
> end Base_Something;
>
> package Derived is
> type Derived_Type is new Base_Type with null record;
> end Derived;
>
> package Derived_Something is
> procedure Something (X : in out Derived_Type; Y : String) is null;
> end Derived_Something;
>
> use Base, Derived, Base_Something, Derived_Something;
> X : Base_Type;
> Y : Derived_Type;
> begin
> Something (X, 1); -- OK
> Something (Y, 2); -- Type error!
> Something (Y, "2"); -- OK
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
Yes, but in the current case, Base_Type is already
defined in a library with the procedures in
the same package as the type. However, this is a good
point for when I make my own types.
prev parent reply other threads:[~2017-05-21 21:45 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-20 17:33 Preventing private procedure visibility being made public through extension Jere
2017-05-20 20:13 ` AdaMagica
2017-05-20 21:55 ` Jere
2017-05-20 20:32 ` Dmitry A. Kazakov
2017-05-20 22:51 ` Jere
2017-05-21 0:51 ` Jere
2017-05-21 9:16 ` Chris Moore
2017-05-21 22:55 ` Jere
2017-05-21 8:44 ` Dmitry A. Kazakov
2017-05-21 12:19 ` J-P. Rosen
2017-05-21 12:53 ` Dmitry A. Kazakov
2017-05-21 20:06 ` Jere
2017-05-21 21:07 ` Dmitry A. Kazakov
2017-05-21 22:28 ` Jere
2017-05-22 8:52 ` Dmitry A. Kazakov
2017-05-22 13:33 ` AdaMagica
2017-05-22 13:43 ` AdaMagica
2017-05-22 21:17 ` Randy Brukardt
2017-05-25 4:06 ` Jere
2017-05-25 19:39 ` Randy Brukardt
2017-05-25 22:53 ` Jere
2017-05-25 22:57 ` Jere
2017-05-26 20:46 ` Randy Brukardt
2017-05-26 22:35 ` Simon Wright
2018-05-20 11:22 ` Simon Wright
2018-05-20 12:03 ` Jere
2017-05-26 22:58 ` Jeffrey R. Carter
2017-05-30 21:15 ` Randy Brukardt
2017-06-02 1:07 ` Jere
2017-06-02 7:31 ` Dmitry A. Kazakov
2017-06-02 8:09 ` Mark Lorenzen
2017-06-02 11:31 ` Simon Wright
2017-05-22 21:12 ` Randy Brukardt
2017-05-23 7:38 ` Dmitry A. Kazakov
2017-05-21 18:14 ` Robert Eachus
2017-05-21 20:21 ` Jere
2017-05-21 21:09 ` Jeffrey R. Carter
2017-05-21 22:46 ` Jere
2017-05-22 21:24 ` Jeffrey R. Carter
2017-05-25 3:45 ` Jere
2017-05-21 21:20 ` Dmitry A. Kazakov
2017-05-21 21:45 ` Jere [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox