comp.lang.ada
 help / color / mirror / Atom feed
* Protected types and visibility of their internals
@ 2008-07-08  9:57 Maciej Sobczak
  2008-07-08 12:52 ` Georg Bauhaus
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Maciej Sobczak @ 2008-07-08  9:57 UTC (permalink / raw)


Consider a protected type in some package:

package P is
   protected type PT is
      procedure Foo;
   private
      X : Some_Type;
   end PT;
end P;

The protected type has a component X of Some_Type, which is entirely
the private business of the protected type.

Where this type should be declared?

My first natural attempt was to put the declaration of Some_Type in
the private part of PT, but this seems to be impossible even at the
grammar level.
My second, although less natural attempt was to put it to the private
part of P, but then it is not visible to PT.

The only place that seems to be allowed is the visible part of P. I
don't find it very comfortable, because I do not intend the users of P
to see Some_Type.
What is the rationale for this?
Can you recommend some other solution that enforces strict coding
practice?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-07-10 21:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-08  9:57 Protected types and visibility of their internals Maciej Sobczak
2008-07-08 12:52 ` Georg Bauhaus
2008-07-08 16:13 ` Robert A Duff
2008-07-09  7:53   ` christoph.grein
2008-07-08 21:03 ` Randy Brukardt
2008-07-10 21:49   ` Maciej Sobczak
2008-07-09  5:04 ` christoph.grein
2008-07-09 13:44   ` Maciej Sobczak
2008-07-09 15:12   ` Adam Beneschan
2008-07-09 22:19 ` Stephen Leake
2008-07-09 22:38   ` Adam Beneschan
2008-07-10  0:18     ` Randy Brukardt
2008-07-10  0:18     ` Randy Brukardt
2008-07-09 23:22 ` jimmaureenrogers

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