From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: DYNAMIC ADA TASK CREATION?
Date: Sat, 28 Jun 2003 07:25:02 GMT
Date: 2003-06-28T07:25:02+00:00 [thread overview]
Message-ID: <3EFD42B5.2060707@attbi.com> (raw)
In-Reply-To: 1ec946d1.0306271654.636c1373@posting.google.com
I wrote:
>> There are times when a programmer will create an object type that
>>contains tasks. And he may want to use, say, a container package for
>>objects of this type. (Yes, most container libraries refuse to work with
>>limited data objects, but not all.)
Matthew Heaney wrote:
> The new release of the Charles library does indeed work with element
> types that are limited. The basic idea is that when you insert an
> element into the container, the element is allocated with its default
> value -- whatever that means for the element type. For example, for
> an element type that is controlled, controlled initialization will
> occur.
Not quite what I had in mind, but great. I was thinking of container
packages that manage references/access values, assuming that the
original objects cannot be moved or changed. When I need a package like
this, I usually encapsulate a "normal" container library around a
limited type and an explicit access type:
generic
type Element is limited private;
type Pointer is access Element;
package Limited_Stack is
procedure Push(E: in Element);
procedure Push(P: in Pointer);
function Peek return Pointer;
function Pop return Pointer;
function Pop return Element; -- constant view...
end Limited_Stack;
The explicit access type is because of the rules on return by reference
providing a constant view. I may propose as an Ada 0Y revision allowing
return by reference functions where a view conversion would be allowed.
In other words, you could have a return by reference function as an in
out parameter in another call. It seems that should be part of AI-318,
but AI-318 goes a lot further without addressing this at all. An
alternative would be allowing a function to return an anonymous access type.
next prev parent reply other threads:[~2003-06-28 7:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-17 19:53 DYNAMIC ADA TASK CREATION? avram
2003-06-17 20:24 ` Simon Wright
2003-06-18 6:11 ` Robert I. Eachus
2003-06-18 9:20 ` Georg Bauhaus
2003-06-18 11:13 ` John McCabe
2003-06-18 12:43 ` John McCabe
2003-06-18 14:17 ` Georg Bauhaus
2003-06-19 5:07 ` Simon Wright
2003-06-19 6:05 ` Robert I. Eachus
2003-06-19 23:30 ` Jeffrey Carter
2003-06-18 19:15 ` avram
2003-06-18 21:17 ` Craig Carey
2003-06-20 18:56 ` avram
2003-06-21 13:06 ` Pascal Obry
2003-06-18 23:28 ` Robert I. Eachus
2003-06-19 5:09 ` Simon Wright
2003-06-19 6:39 ` Robert I. Eachus
2003-06-19 20:34 ` Simon Wright
2003-06-28 0:54 ` Matthew Heaney
2003-06-28 7:25 ` Robert I. Eachus [this message]
2003-06-30 7:35 ` Dmitry A. Kazakov
2003-06-30 15:01 ` Matthew Heaney
2003-07-01 7:19 ` Dmitry A. Kazakov
2003-07-01 14:21 ` Matthew Heaney
2003-07-02 12:05 ` Mário Amado Alves
2003-07-02 19:41 ` Simon Wright
2003-07-03 21:31 ` Mário Amado Alves
2003-07-03 9:53 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox