From: Mats.Weber@matrix.ch (Mats Weber)
Subject: Re: ADA Objects Help!
Date: Wed, 25 Jan 1995 20:44:53 GMT
Date: 1995-01-25T20:44:53+00:00 [thread overview]
Message-ID: <Mats.Weber-2501952144530001@mlma11.matrix.ch> (raw)
In-Reply-To: 3forgl$11cd@watnews1.watson.ibm.com
In the rest of this message, I assume that type and exception declarations
are not allowed in the visible part of package types.
In article <3forgl$11cd@watnews1.watson.ibm.com>, ncohen@watson.ibm.com wrote:
> In article <Mats.Weber-1901951739360001@mlma11.matrix.ch>,
> Mats.Weber@matrix.ch (Mats Weber) writes:
>
> |> In article <3fhggr$11dp@watnews1.watson.ibm.com>,
ncohen@watson.ibm.com wrote:
> |>
> |> > Because, unlike task units, package units export declarations for use
> |> > outside.
> |>
> |> Well, tasks export entries, which are usable outside just like subprograms
> |> exported from packages.
>
> True enough. The entries are per-type entities, whose declarations are
> elaborated once for each task type. (This is noticeable by the fact that
> entry-family discrete ranges are elaborated once per task type, not once
> for each object of the type.) Entities declared in the declarative part
> of the task body are per-object entities, whose declarations are
> elaborated once per object.
The same rules can be adopted for package types (it's probably the only
reasonable choice anyway).
> The distinction I was trying to make (alhtough I wasn't very clear about
> it) was about per-object entities: The entities declared in a package-
> type declaration would be exported by each object in the package type,
> unlike the per-object entities of a task type.
I must be missing something here. I see entries as belonging to task
_objects_, not task _types_. If you write
procedure P renames T.E;
then P denotes the E entry of the task _object_ T. Moreover, you cannot
refer to an entry of a task type directly. You need a task object.
> |> > package type PT is -- THIS IS NOT VALID ADA XX for XX <= 95 !!!!!!
> |> > N: Integer := [some nonstatic expression];
> |> > type T is array (1 .. N) of Integer;
> |> > end PT;
> |> >
> |> > Package_1, Package_2: PT;
> |>
> |> The declaration for N does not cause a problem. It would be treated just
> |> like a record component declaration with a default initial value (i.e. the
> |> nonstatic expression is evaluated at each elaboration of a PT).
>
> This is beginning to look suspiciously like a generic package. Generic
> templates are the only program units in Ada with the property that
> declarations inside the program-unit declaration are not elaborated as
> part of the elaboration of the program-unit declaration.
To me it looks more like a record type than like a generic package.
Declarations inside the visible part are elaborated at the type
declaration, but not the default initial values, just like for records.
Example:
package type T is -- not legal Ada
N : Integer range 0 .. Max := Initial;
end T;
is almost equivalent to
type T is
record
N : Integer range 0 .. Max := Initial;
end record;
I could have written the proposal in my thesis using record types and
allowing procedures as record components (like in N. Cohen's paper), but I
wanted a construct that could express ADTs in a very similar way whether
that ADT was concurrent or not. (I also wanted to be able to export
generic subprograms from my package types, for reasons I won't explain
here). Thus package types and task types.
Another solution preserving the symmetry would be record types + a change
in syntax for task types:
type T is
task
entry A;
end task;
which would remove the dissymmetry between Ada's task types and other
types. But these considerations are purely syntactical and of limited
interest.
> The term package type is beginning to look like a misnomer. The
> instances of these types are far more restricted than packages are.
> In fact they are even more restricted than generic packages.
> A package that cannot provide types is little more than a record.
This is a matter of taste, I guess. One similar thing I don't like in Ada
is that a task cannot be a library unit.
Mats
next prev parent reply other threads:[~1995-01-25 20:44 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3f9g1u$j4m@nps.navy.mil>
[not found] ` <D2H5un.FEr@nntpa.cb.att.com>
[not found] ` <3fcs59$70s@nps.navy.mil>
[not found] ` <3ff186$c19@gnat.cs.nyu.edu>
1995-01-17 17:57 ` ADA Objects Help! Mats Weber
1995-01-18 17:47 ` Robert Dewar
1995-01-20 16:04 ` Mats Weber
1995-01-21 18:59 ` Robert Dewar
1995-01-23 12:03 ` Robb Nebbe
1995-01-25 20:44 ` Mats Weber
1995-01-25 20:44 ` Mats Weber
1995-01-27 4:03 ` Robert Dewar
1995-01-26 3:36 ` swdecato
[not found] ` <3fhggr$11dp@watnews1.watson.ibm.com>
[not found] ` <Mats.Weber-1901951739360001@mlma11.matrix.ch>
1995-01-20 17:22 ` Norman H. Cohen
1995-01-23 16:37 ` Mats Weber
1995-01-25 20:44 ` Mats Weber [this message]
1995-01-27 4:05 ` Robert Dewar
1995-01-19 11:57 ` Robert M. Wilkinson
1995-01-22 18:06 ` Robert Dewar
1995-01-24 22:18 ` Norman H. Cohen
1995-01-25 1:26 ` swdecato
1995-01-25 18:18 ` Bob Kitzberger
1995-01-25 20:11 ` Bob Kitzberger
1995-01-26 15:31 ` Norman H. Cohen
[not found] ` <D330pK.M1@nntpa.cb.att.com>
1995-01-28 21:46 ` John DiCamillo
1995-01-30 14:13 ` David Emery
1995-01-30 22:50 ` Subject/Object Confusion Syndrome [was: Ada Objects Help] John Volan
1995-02-01 14:33 ` Norman H. Cohen
[not found] ` <D3DpJu.4nK@swlvx2.msd.ray.com>
[not found] ` <D3H7J3.B2x@inmet.camb.inmet.com>
1995-02-06 10:32 ` Robb Nebbe
[not found] ` <3gu21g$ch@portal.gmu.edu>
1995-02-06 14:01 ` John Volan
1995-02-01 22:37 ` Maarten Landzaat
[not found] ` <3h1ahp$gf5@gnat.cs.nyu.edu>
[not found] ` <3h3jmp$1h1@Starbase.NeoSoft.COM>
1995-02-07 14:39 ` John Volan
1995-02-09 2:25 ` David Weller
1995-01-29 18:19 ` ADA Objects Help! mat
[not found] ` <1995Feb5.180601@hobbit>
1995-02-07 23:04 ` Subject/Object Confusion Syndrome [was: Ada Objects Help] John Volan
1995-01-25 9:48 ` ADA Objects Help! mat
1995-01-23 10:01 ` calling syntax (was Re: Ada Objects) Robb Nebbe
1995-01-23 18:08 ` John DiCamillo
1995-01-23 23:47 ` ADA Objects Help! Ed Osinski
1995-01-25 6:19 ` David O'Brien
[not found] ` <1995Jan16.132400@lglsun.epfl.ch>
[not found] ` <131279@cup.portal.com>
1995-01-20 16:52 ` Ada " Robert Dewar
1995-01-22 18:30 ` Tucker Taft
1995-01-24 22:09 ` Jacob Sparre Andersen
1995-01-26 16:20 ` Robert A Duff
1995-01-27 17:04 ` Robert A Duff
1995-01-27 19:58 ` Tucker Taft
1995-01-20 17:41 ` Mark S. Hathaway
1995-01-23 10:41 ` Robb Nebbe
1995-01-23 11:53 ` Stephane Barbey
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox