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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4ac6c27957bfd114 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news-lei1.dfn.de!news-ber1.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Amey Newsgroups: comp.lang.ada Subject: Re: What is the point of Private? Date: Fri, 29 Apr 2005 10:07:29 +0100 Message-ID: <3debqiF6s66aeU1@individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net PRhVWqSpWfdlB0CPD/qsJA1IyKH7WvKOMguxLBuy7ZRJYNCm8= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:10805 Date: 2005-04-29T10:07:29+01:00 List-Id: Jeffrey Carter wrote: > Simon Smith wrote: > >> Why is it there? I am sure I have heard talk that its to stop the >> client from seeing exactly how the data is stored/manipulated however >> if people really did want to know this wouldn't they just scroll down >> the ada spec file and find out for themselves or am I missing >> something here? > > > No, it was there originally to put stuff that the compiler needs to know > to compile client code, but that the client code doesn't need to know to > use the package. (Actually, the compiler probably doesn't need to know > that stuff, and it could be put in the body, but in the late 1970's > Ada's designers weren't willing to accept the extra work and overhead > that would entail.) I think there are real compiler design issues here. Modula 2 had "opaque types" which were conceptually similar to private types. However, Modula 2 had no equivalent of a package's private part which meant that the size of the opaque type wasn't known and that all implementations therefore required an opaque type to be implemented as a pointer. Ada's scheme means the size is known to the compiler from the package spec alone. > > Now, it also serves to put stuff that will be visible to the private > parts and bodies of children, but not to anyone else. > Which is rather useful! Peter