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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,cb04cee6116c8ced X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!l19g2000yqb.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Package's private parts and protected types Date: Tue, 9 Feb 2010 02:58:53 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <7ff3810f-3ee3-4f39-a54c-933ad7d0655c@36g2000yqu.googlegroups.com> <1v2la97s2yyvd.1rcy0ana8mver.dlg@40tude.net> <3bb38996-47f7-4f30-8255-f011501404b5@b10g2000yqa.googlegroups.com> NNTP-Posting-Host: 77.198.58.172 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1265713238 8915 127.0.0.1 (9 Feb 2010 11:00:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Feb 2010 11:00:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l19g2000yqb.googlegroups.com; posting-host=77.198.58.172; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9026 Date: 2010-02-09T02:58:53-08:00 List-Id: On 8 f=E9v, 15:56, Robert A Duff wrote: > "Hibou57 (Yannick Duch=EAne)" writes: > Private parts are a kludge in the first place, and the way > they work with public protected types is even worse, as > you pointed out. > > However, I think you can get the hiding you want by using > a protected or synchronized interface. > protected, task and synchronized interface seems nice at first sight. All three because they states what things are, while hiding implementation details. The third one especially, because the Synchronized tray in clean- abstract (as the Ada 95 rationale says on purpose, there is mostly no difference, from a client point of view, between a protected type and a task type). But these interfaces type are too much restrictive. As an example, it does not allow to define a type which could be automatically allocated in a local scope. It impose a design where the client must rely on access to class-wide. This may be nice... but only it was decided to be so. If something else was to be done, we face a no choice-path. A direct consequence is also that it requires to use and manage dynamic allocation in a none-clean way, as the client must make direct use of an access type. If multiple types are to be defined with same consequences for each, things become not clean at all. I feel (at least from my point of view), the most practicable manner is still to define a private type with primitives, and wrap things inside that private type in the private part (so there may be no better design than the initially introduced one).