comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <jrcarter@acm.org>
Subject: Re: Hiding details and protected types
Date: Tue, 24 Apr 2007 19:16:17 GMT
Date: 2007-04-24T19:16:17+00:00	[thread overview]
Message-ID: <5IsXh.13313$n_.7303@attbi_s21> (raw)
In-Reply-To: <f0l1kb$568$1@cernne03.cern.ch>

Maciej Sobczak wrote:
> 
> It is not possible to declare this type in the private part of the 
> protected type (why?), so it has to be declared outside PT:
> 
> type T is ...;
> protected type PT is
>   procedure P;
> private
>   A : T;
> end PT;
> 
> The problem is that declaring T in the same declaration scope pollutes 
> the name space and is against Good Engineering Principles (tm).

I agree. You can't hide the existence of T, but you can usually hide its 
details:

    type T is private;

    protected type P is
       ...
private
    type T is ...;

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26



  parent reply	other threads:[~2007-04-24 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 13:44 Hiding details and protected types Maciej Sobczak
2007-04-24 15:04 ` Jean-Pierre Rosen
2007-04-24 18:18   ` Randy Brukardt
2007-04-24 19:16 ` Jeffrey R. Carter [this message]
2007-04-24 21:31 ` Georg Bauhaus
replies disabled

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