comp.lang.ada
 help / color / mirror / Atom feed
From: rick H <rik_nntp@dsl.pipex.com>
Subject: Re: Instantiating private types with discriminants?
Date: Tue, 09 May 2006 14:06:53 GMT
Date: 2006-05-09T14:06:53+00:00	[thread overview]
Message-ID: <1m18g.28776$Nb2.522087@news1.nokia.com> (raw)
In-Reply-To: 44609cf7$0$11072$9b4e6d93@newsread4.arcor-online.net

Georg Bauhaus <bauhaus@futureapps.de> wrote:
> 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;
> 
Thanks Georg - I understand now!


Rick



  reply	other threads:[~2006-05-09 14:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 13:17 Instantiating private types with discriminants? rick H
2006-05-09 13:45 ` Georg Bauhaus
2006-05-09 14:06   ` rick H [this message]
2006-05-09 13:56 ` Ludovic Brenta
2006-05-09 14:24   ` rick H
2006-05-09 19:48     ` Ludovic Brenta
2006-05-09 14:05 ` Dmitry A. Kazakov
2006-05-09 14:48 ` rick H
2006-05-09 15:20   ` Jerry Petrey
2006-05-09 15:42     ` rick H
2006-05-09 15:53   ` Avoiding use Ada.Tags (was Re: Instantiating private types with discriminants?) Alex R. Mosteo
2006-05-09 16:01   ` Instantiating private types with discriminants? Dmitry A. Kazakov
2006-05-10  7:42     ` rick H
2006-05-10  9:09       ` Ludovic Brenta
2006-05-10 11:49         ` Georg Bauhaus
2006-05-10 13:44         ` rick H
2006-05-10 14:21           ` Ludovic Brenta
2006-05-10 15:10             ` rick H
2006-05-10 15:45               ` Ludovic Brenta
2006-05-10 14:41           ` Dmitry A. Kazakov
2006-05-10 15:34             ` rick H
2006-05-10 19:01               ` Georg Bauhaus
2006-05-10 19:05                 ` Ludovic Brenta
2006-05-10 21:52                   ` Rick H
2006-05-11  1:17                     ` Jeffrey R. Carter
2006-05-11  7:44                     ` Dmitry A. Kazakov
2006-05-11  8:27                       ` rick H
2006-05-11 10:28                         ` Dmitry A. Kazakov
2006-05-11 15:59                           ` Robert A Duff
2006-05-12  7:37                             ` Dmitry A. Kazakov
2006-05-12  9:24                               ` Georg Bauhaus
2006-05-12 12:40                                 ` Dmitry A. Kazakov
2006-05-12 18:25                                   ` Randy Brukardt
2006-05-09 19:57   ` "Use" and "=" for Tags (was: Re: Instantiating private types with discriminants?) Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox