comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: Generics and Child Packages
Date: Sun, 11 Aug 2013 08:49:06 -0700 (PDT)
Date: 2013-08-11T08:49:06-07:00	[thread overview]
Message-ID: <79ec97f1-b5f8-4b12-b351-262fad685f50@googlegroups.com> (raw)
In-Reply-To: <d717e583-7238-439e-b60e-c3d0f2177640@googlegroups.com>

Thank you both for your response.  I've ended up splitting all packages into separate, unrelated packages that are all generic on all the (common) types, and then having the parent just be instantiations of the others.  This obviously isn't a perfect solution, as the private data is still technically accessible (in that nothing stops a client from instantiating his own version of the private data), and of course it's a whole lot of meaningless typing, but I guess it's the best of a bad situation.

Though I still don't buy the "children of a generic are a generic" explanation.  Semantically there is no difference between a nested package and a child package, so any reason for the latter being "officially" generic (i.e. requiring instantiation) should also apply to the former, which it clearly does not.  It's senseless that this should be okay:

generic
package P
private
   package C is
      ...
   end C;
end P;

but that this should be not:

generic
package P
   ...
end P;

private package P.C is
   ...
end P.C;

when you consider there is no (conceptual) difference.

-sb


  parent reply	other threads:[~2013-08-11 15:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 20:35 Generics and Child Packages sbelmont700
2013-08-10  9:25 ` AdaMagica
2013-08-10 15:39 ` Felix Krause
2013-08-11 15:49 ` sbelmont700 [this message]
2013-08-11 16:51   ` Robert A Duff
2013-08-11 18:30   ` AdaMagica
2013-08-11 19:20   ` Shark8
2013-08-12 20:27   ` Randy Brukardt
2013-08-12 21:58     ` Simon Wright
2013-08-12 20:19 ` Randy Brukardt
replies disabled

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