comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Protected types and visibility of their internals
Date: Tue, 08 Jul 2008 12:13:33 -0400
Date: 2008-07-08T12:13:33-04:00	[thread overview]
Message-ID: <wccod5873rm.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: b1f2203b-ed02-4031-bcba-40c0e1b1be07@j22g2000hsf.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> 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?

I don't think there's any good solution to this.

You could put it in a nested package called Private_Stuff,
with a comment saying clients shouldn't mess with it.

> What is the rationale for this?

I don't remember exactly, but I think there are anomalies if you start
allowing types to be declared inside types.

- Bob



  parent reply	other threads:[~2008-07-08 16:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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