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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,152a2caafe08bc4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-26 23:02:05 PST Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!opentransit.net!wanadoo.fr!freenix!enst!enst.fr!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: scope and visibility Date: Wed, 27 Feb 2002 08:00:48 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1014793322 64353 137.194.161.2 (27 Feb 2002 07:02:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 27 Feb 2002 07:02:02 +0000 (UTC) Return-Path: Content-MD5: UuSnu2xYeY9LUjoPhtfWLQ== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: Christoph Grein List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:20501 Date: 2002-02-27T08:00:48+01:00 > but I'm having quite a hard time with 'private' and friends. The Ada keyword 'private' means that you do not see into the thing denoted as private. Thus a private type hides its details, you do not see them and cannot assume anything about them. 'private' in a package hides anything behind from visibility outside this hierarchy. package P is type T is private; ...operations... private type T is new Integer; end P; If you're outside of P, you cannot make use of the fact that T is an integer. It could be anything (array, record, ...) that is not limited (another Ada keyword). Inside of P, after the keyword 'private' and also in the body, you of course can use the fact that T is Integer. This is also true for children of P. private package P.Priv_Child is -- You see the private part of P here. private end P.Priv_Child; package P.Child is -- You do not see the private part of P here. private -- You see the private part of P here. end P.Child; This is approximately like (but there _are_ differences): package P is type T is private; ...operations... package Child is ... end Child; private type T is new Integer; package Priv_Child is ... end Priv_Child; end P; Now try package P.Priv_Child.Grand_Child is ... private P.Priv_Child.Priv_Grand_Child is ... package P.Child.Grand_Child is ... private P.Child.Priv_Grand_Child is ... These all have different visibilities. generic type T is private; package P is -- You cannot assume anything about P except that it's not limited and -- that it is definite. end P;