comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Protected types and visibility of their internals
Date: Tue, 8 Jul 2008 02:57:56 -0700 (PDT)
Date: 2008-07-08T02:57:56-07:00	[thread overview]
Message-ID: <b1f2203b-ed02-4031-bcba-40c0e1b1be07@j22g2000hsf.googlegroups.com> (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



             reply	other threads:[~2008-07-08  9:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08  9:57 Maciej Sobczak [this message]
2008-07-08 12:52 ` Protected types and visibility of their internals 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
replies disabled

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