comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada202X: Easy to use "UML private"-like components
Date: Tue, 25 Jun 2013 14:19:51 -0500
Date: 2013-06-25T14:19:51-05:00	[thread overview]
Message-ID: <kqcqgo$lku$1@loke.gir.dk> (raw)
In-Reply-To: b2rsmlFpmvmU1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:b2rsmlFpmvmU1@mid.individual.net...
> On 13-06-24 23:20 , Randy Brukardt wrote:
...
>> In any case, the Modula-2 obaque type is *not* a
>> pointer type, so in that sense it is much more like an Ada private type 
>> than
>> an access type of any sort.
>
> I can agree, if we consider only the user's point of view. Both opaque
> types and stt-access-types are declared as private -- the user (client)
> does not see their structure or nature.

Only the client's point of view matters for both private and opaque types, 
as inside the package the full views are available. There is nothing of 
interest to say about private types from inside the package.

You're conflating the properties of full view (for opaque types, that's 
essentially an access-to-stt-incomplete, which of course is a possibility in 
Ada as well) with the properties of the partial view (which is what the 
client sees). These views can only be considered separately, as no one can 
see both.

...
> The main difference is that in Ada, the unknown underlying type is named
> -- what you call the stt-incomplete type. This type is of course
> invisible to the users (clients) of the private type. Off hand, it does
> not seem to me that such named-but-incomplete types should cause hard
> problems for the compiler, but it appears that you have experienced such
> problems. Perhaps they did not exist in Ada 83, but came about because
> of other extensions such as controlled types?

The real problem is that they're useless (at least for me), especially 
directly as the full type of a private type. Once you have an explicit 
access type somewhere, you also have to have explicit memory management. But 
there is no way to free objects when their objects go away unless the full 
object is controlled. Which means it is *not* an access type.

You have to have a controlled record type in the private part to contain 
that access-to-stt-incomplete, or you are going to leak memory. And you need 
to know the size of that record type; ergo, you have to have a private part 
or something like it.

I've tried many times over the years to use an stt-incomplete in the private 
part of a package (even as an access component of the private type, not the 
private type itself), but 90% of the time, some issue comes up that has 
forced me to move the declarations to the private part. I don't even bother 
to try anymore, it's simply not worth the hassle.

                           Randy.




  parent reply	other threads:[~2013-06-25 19:19 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  8:43 Ada202X: Easy to use "UML private"-like components Martin
2013-06-21  9:23 ` Dmitry A. Kazakov
2013-06-21  9:33   ` Martin
2013-06-21 10:14     ` G.B.
2013-06-21 11:19       ` Martin
2013-06-21 14:51     ` Dmitry A. Kazakov
2013-06-22 11:16       ` Martin
2013-06-22 12:10         ` Dmitry A. Kazakov
2013-06-21 18:36 ` Robert A Duff
2013-06-22 16:41   ` Niklas Holsti
2013-06-22 19:05     ` Dennis Lee Bieber
2013-06-22 22:57       ` Niklas Holsti
2013-06-23  3:26         ` Dennis Lee Bieber
2013-06-23  7:32           ` Niklas Holsti
2013-06-23 13:12             ` Robert A Duff
2013-06-23 14:06               ` Dmitry A. Kazakov
2013-06-23 15:15                 ` Robert A Duff
2013-06-23 18:52                   ` Dmitry A. Kazakov
2013-06-23 23:38                     ` Robert A Duff
2013-06-24  7:16                       ` Dmitry A. Kazakov
2013-06-24 20:11                         ` Randy Brukardt
2013-06-25  7:21                           ` Dmitry A. Kazakov
2013-06-25 19:06                             ` Randy Brukardt
2013-06-24 20:07                 ` Randy Brukardt
2013-06-23 14:40               ` Shark8
2013-06-23 15:28                 ` Robert A Duff
2013-06-23 18:14                   ` Bill Findlay
2013-06-23 23:43                     ` Robert A Duff
2013-06-23 23:48                       ` Bill Findlay
2013-06-24 20:16                   ` Randy Brukardt
2013-06-24 20:05               ` Randy Brukardt
2013-06-25  1:09                 ` Robert A Duff
2013-06-25 19:37                   ` Randy Brukardt
2013-06-23 12:28         ` Robert A Duff
2013-06-24 20:20           ` Randy Brukardt
2013-06-24 21:40             ` Niklas Holsti
2013-06-25  0:43               ` Robert A Duff
2013-06-25 19:23                 ` Randy Brukardt
2013-06-25 19:19               ` Randy Brukardt [this message]
2013-07-09 11:24   ` Martin
2013-07-09 14:39     ` Simon Wright
2013-07-10  7:03       ` Martin
2013-07-09 21:43     ` Robert A Duff
2013-07-10  6:34       ` Martin
2013-07-10  8:24         ` Dmitry A. Kazakov
2013-07-10 13:06           ` Martin
2013-07-10 16:12     ` Simon Wright
2013-07-10 18:22       ` Martin
2013-07-10 19:41         ` Simon Wright
2013-07-11 18:28           ` Martin
2013-07-11 19:37             ` Simon Wright
2013-07-11 20:43               ` Martin
2013-07-12  6:57                 ` Simon Wright
2013-07-12  8:05                   ` Martin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox