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,dad94612ff745427 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Tue, 09 May 2006 15:45:32 +0200 From: Georg Bauhaus Organization: future apps GmbH User-Agent: Thunderbird 1.5.0.2 (X11/20060420) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Instantiating private types with discriminants? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <44609cf7$0$11072$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Date: 09 May 2006 15:45:27 MEST NNTP-Posting-Host: 3dc2ffcc.newsread4.arcor-online.net X-Trace: DXC=IOXDnU1B2YbXiD6\]5e5en:ejgIfPPlddjW\KbG]kaMh]kI_X=5KeafokT[4R<=ZKbUUng9_FXZ=c>:=P9Ihe`Bh@Z?dZ]MOide X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:4149 Date: 2006-05-09T15:45:27+02:00 List-Id: rick H wrote: > So, my question to the experts is: Why does "privatising" a type's > details change the way that you "new" instantiations of it? You cannot write down the private components of a private type anywhere they are invisible. Even though your private type Type_B doesn't actually have private components, that isn't known outside Discrim's private part, i.e. in procedure Use_Discrim . Consider: with Discrim; use Discrim; procedure Use_Discrim is A_Thing: Type_A; B_Thing: Type_B; Another_B_Thing: Type_B(Param => 42); -- declaring with constraint A : Type_A_Ptr; -- public implementation B : Type_B_Ptr; -- private implementation begin A_Thing := (Param => 100); B_Thing := (Param => 100); -- what about the private components? A_Thing := Type_A'(Param => 100); A_Thing := Type_A (Param => 100); A := new Type_A'(Param => 100); -- qualified expression B := new Type_B (Param => 123); -- ? end Use_Discrim;