comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: Full view of a private partial view cannot be a subtype
Date: Mon, 18 Dec 2017 17:22:05 -0800 (PST)
Date: 2017-12-18T17:22:05-08:00	[thread overview]
Message-ID: <c29c753e-18e9-475b-9a28-a19aa697ea2f@googlegroups.com> (raw)
In-Reply-To: <p19gim$k2u$1@franka.jacob-sparre.dk>

On Monday, December 18, 2017 at 5:47:51 PM UTC-5, Randy Brukardt wrote:
> "Dmitry A. Kazakov" wrote in message 
> > On 2017-12-17 16:26, Jere wrote:
> >
> >> my assertion is that:
> >>
> >>     subtype Thing is Core_Pkg.Thing;
> >>
> >>     procedure Do_Something(The_Thing : in out Thing)
> >>        renames Core_Pkg.Do_Something;
> >>         is easier to both maintain and read than:
> >>
> >>     type Thing is new Core_Pkg.Thing with null record;
> >>     procedure Do_Something(The_Thing : in out Thing);
> >
> > But these are two semantically different concepts. Ada's subtype declares 
> > an equivalent type [it inherits everything from and exports everything to 
> > the base]. Ada's new tagged type declares a new instance of a class. It 
> > only inherits.
> >
> > I don't understand how can you exchange one for another.
> 
> You can't really; they're very different concepts. The OP is showing a 
> confusion, because the renames he wants is perfectly legal, assuming proper 
> visibility. And if the items in question are private, then he is trying to 
> make a privacy leak -- which the language will not make easy for obvious 
> reasons.
> 
>                             Randy/

I'm not really trying to make a privacy leak on purpose.  I'm just trying to
provide a simpler interface to a much more complex and dangerous generic
so that someone doesn't accidentally use something they shouldn't.  Any 
privacy leaks are not intentional.  I was just asking a question.  Using
either extension, derivations, or composition all seemed very heavy handed
for just wanting to mimic the same specification as another generic.  Subtypes
and renames expressed exactly the relationship I wanted, but the only thing
I couldn't do was hide a deallocation operation that should never be called
directly (it was an input to the base generic).  That one items is what 
got me to this question.  I wanted to see if there was a way to keep the
subtype/rename method while hiding the operation and the answer looks to be
no.  But I wasn't sitting around twiddling my fingers looking for ways to
break Ada privacy in the process.  I just wanted to understand if there was
a way and if not, why.  That's all, nothing nefarious on my part, at least
not intentionally.


  reply	other threads:[~2017-12-19  1:22 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
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 [this message]
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