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,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 21 Jun 2013 12:14:12 +0200 From: "G.B." User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada202X: Easy to use "UML private"-like components References: <69246de0-4b33-4d47-b5be-a45e8c911fb0@googlegroups.com> <28f43920-c490-4da0-80b3-6405dec09879@googlegroups.com> In-Reply-To: <28f43920-c490-4da0-80b3-6405dec09879@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <51c42774$0$6633$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 Jun 2013 12:14:12 CEST NNTP-Posting-Host: f3dc04ab.newsspool2.arcor-online.net X-Trace: DXC=:RooYE9d4d?RadXUBHgFh3A9EHlD; 3Yc24Fo<]lROoR18kF:Lh>_cHTX3j=O On 21.06.13 11:33, Martin wrote: > On Friday, June 21, 2013 10:23:51 AM UTC+1, Dmitry A. Kazakov wrote: >> On Fri, 21 Jun 2013 01:43:05 -0700 (PDT), Martin wrote: > Secondly, I have to explain that using Ada "private" gives you "UML protected": Ada's private gives both protected for children of the package and private for non-children. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de > > But no easy means of keeping member data private from children. But no pointers needed; I hope the following example is a reasonably accurate paraphrase of a hint given by Tucker Taft some years ago, memory is vague. Not sure if UML has a concept for capturing this, but confident that Grady Booch knows Ada's visibility rules well. (Or should one find a sentence that has "possibilities" instead of "rules"?) package Opaque is type Exposed is tagged private; private package Invisible is type T is tagged private; private type Scalr is range 1 .. 2; type T is tagged record Comp_1 : Scalr; end record; end Invisible; type Exposed is new Invisible.T with null record; end Opaque; private package Opaque.Child is A : Invisible.T; Y : Invisible.Scalr := A.Comp_1; end Opaque.Child; Compiling: opaque-child.ads (source file time stamp: 2013-06-21 10:06:44) 4. Y : Invisible.Scalr := A.Comp_1; 1 2 >>> "Scalr" is not a visible entity of "Invisible" >>> no selector "Comp_1" for private type "T" defined at opaque.ads:8 5 lines: 2 errors Thus, even a private child cannot see anything behind doubled fences. I imagine that explaining this needs some spin doctoring.