From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51359402da60c472 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-28 00:25:03 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!nntp.cs.ubc.ca!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc03.POSTED!not-for-mail Message-ID: <3EFD42B5.2060707@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? References: <3EF0026E.2050309@attbi.com> <3EF0F57D.9060507@attbi.com> <3EF15A7C.4030901@attbi.com> <1ec946d1.0306271654.636c1373@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1056785102 24.62.164.137 (Sat, 28 Jun 2003 07:25:02 GMT) NNTP-Posting-Date: Sat, 28 Jun 2003 07:25:02 GMT Organization: AT&T Broadband Date: Sat, 28 Jun 2003 07:25:02 GMT Xref: archiver1.google.com comp.lang.ada:39863 Date: 2003-06-28T07:25:02+00:00 List-Id: 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.