From: "Thierry Lelegard" <thierry.lelegard@canal-plus.fr>
Subject: Ada 0y wish list: "with private"
Date: Mon, 12 Feb 2001 14:41:03 +0100
Date: 2001-02-12T14:41:03+01:00 [thread overview]
Message-ID: <968p1e$8m7$1@s1.read.news.oleane.net> (raw)
Recently, several wishlist items for Ada 0y were posted in c.l.a.
Like many old Ada users, I have a couple of them. I would like to
propose one for discussion: a "with private" extension.
The idea is to specify in a context clause of a unit spec that an
external unit can be used only in the private part.
Example:
with A;
with private B;
package C is
X : A.TA;
private
Y : B.TB; -- legal only in private part
end C;
There are two advantages:
1) Readability. The user of package C is only interested in the public
interface of C. Reading "with private B", the user knows that he may
safely ignore what the strange unit B is all about.
2) Use of private packages in private parts. Example:
package Lib is ...
private package Lib.Internals is ....
with private Lib.Internals;
package Lib.Public is
....
private
type TP is new Lib.Internals.TI ...
end Lib.Public;
The second point is, of course, more important than the first one. Some
of my recent code could have been much simpler with such a possibility.
In Ada 95, a private package cannot be referenced at all in the spec
of a public package, even in the private part, since the context clause
"with Lib.Internals" is simply refused.
Two points:
- The "with private" syntax is, of course, only a suggestion.
- Maybe there is some implementation flaw that I missed.
Any ideas or objections?
-Thierry
____________________________________________________________________________
Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr
CANAL+ Technologies, 34 place Raoul Dautry, 75516 Paris Cedex 15, France
Tel: +33 1 71 71 54 30 Fax: +33 1 71 71 52 08 Mobile: +33 6 03 00 65 75
____________________________________________________________________________
next reply other threads:[~2001-02-12 13:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-12 13:41 Thierry Lelegard [this message]
2001-02-13 0:10 ` Ada 0y wish list: "with private" Keith Thompson
2001-02-13 0:13 ` Jeff Creem
2001-02-13 6:37 ` Dale Stanbrough
2001-02-13 12:01 ` Jeff Creem
2001-02-13 8:48 ` Dr Adrian Wrigley
2001-02-13 8:56 ` Michel Gauthier
2001-02-13 16:31 ` Ehud Lamm
-- strict thread matches above, loose matches on Subject: below --
2001-02-15 1:04 Beard, Frank
2001-02-15 4:18 ` Jeffrey Carter
2001-02-15 4:53 Christoph Grein
2001-02-15 19:16 Beard, Frank
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox