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-30 00:35:57 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? Date: Mon, 30 Jun 2003 09:35:54 +0200 Message-ID: <0gpvfv49qaa0b62ab5m0kg39kka66sis8t@4ax.com> References: <3EF0026E.2050309@attbi.com> <3EF0F57D.9060507@attbi.com> <3EF15A7C.4030901@attbi.com> <1ec946d1.0306271654.636c1373@posting.google.com> <3EFD42B5.2060707@attbi.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1056958554 32225486 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:39922 Date: 2003-06-30T09:35:54+02:00 List-Id: On Sat, 28 Jun 2003 07:25:02 GMT, "Robert I. Eachus" wrote: >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; A short question. Why not: type Element (<>) is limited private; [I am using this in my containers because it is weaker than just 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. Or both! Returned anonymous access type could be very useful for tagged types, because it would make operations returning a pointer primitive and covariant, which is presently impossible. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de