From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!feeds.phibee-telecom.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada202X: Easy to use "UML private"-like components Date: Tue, 25 Jun 2013 14:19:51 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <69246de0-4b33-4d47-b5be-a45e8c911fb0@googlegroups.com> <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1372187992 22174 69.95.181.76 (25 Jun 2013 19:19:52 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 25 Jun 2013 19:19:52 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Original-Bytes: 4002 Xref: number.nntp.dca.giganews.com comp.lang.ada:182082 Date: 2013-06-25T14:19:51-05:00 List-Id: "Niklas Holsti" 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.