comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Rationale for this not to compile?
Date: Fri, 25 Jul 2014 16:18:03 +0300
Date: 2014-07-25T16:18:03+03:00	[thread overview]
Message-ID: <lqtle9$k37$1@speranza.aioe.org> (raw)
In-Reply-To: lqrro8$hbi$1@speranza.aioe.org

Victor Porton wrote:

> Is there any rationale why this does not compile? If it compiled, it would
> be probably useful in practice with a real example similar to the below
> toy example (as to make the type T not private, I must create an
> *.Internal.* package to serve as a "private repository" for types like T,
> as real private types cannot be used). It is called a hack.
> 
> gnatmake -q -c -gnatc -u -P/home/porton/t/default.gpr test.ads
> test.ads:10:32: premature use of private type
> gnatmake: "/home/porton/t/test.ads" compilation error
> 
> package Test is
> 
>    generic
>       type T is limited private;
>    package Gen is
>    end Gen;
>    
>    type X is private;
> 
>    package Instance is new Gen(X);
>    
> private
>    
>    type X is null record;
>    
> end Test;

My specific problem was solved replacing

   generic
      type T is limited private;

with

   generic
      type T;

-- 
Victor Porton - http://portonvictor.org

      parent reply	other threads:[~2014-07-25 13:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 20:53 Rationale for this not to compile? Victor Porton
2014-07-24 21:36 ` Adam Beneschan
2014-07-25  5:29   ` Randy Brukardt
2014-07-25 12:19     ` Victor Porton
2014-07-25 12:35       ` AdaMagica
2014-07-25 14:40     ` Robert A Duff
2014-07-25 19:45       ` Randy Brukardt
2014-07-25 20:33         ` Robert A Duff
2014-07-25 13:18 ` Victor Porton [this message]
replies disabled

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