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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Discriminant of a limited type object Date: Thu, 1 Mar 2018 16:00:39 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Thu, 1 Mar 2018 22:00:40 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="20924"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50772 Date: 2018-03-01T16:00:39-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:p78een$1jfi$1@gioia.aioe.org... > On 01/03/2018 00:10, Randy Brukardt wrote: ... >> Ada 2020 has you covered: >> >> function F(Index : Natural) return Element is >> begin >> return do-init of A (Index - 1); >> end F; >> A : T (1..N) := (for I in 1 .. N => F(I)); >> >> Note the new iterator choice in the aggregate. > > Definitely less ugly than recursion. But does this "loop" guarantee that F > will be called in the order? Nope, it's an aggregate and can be evaluated in any order. No aggregate is appropriate for something that has to be done sequentially. (With the exception of array delta aggregates; perhaps you could jury-rig something using one of them.) It's not clear that there is much use for streaming of limited objects, as streaming is very much like assignment (it makes a copy of the object). One would expect that if assignment is a problem, so would streaming be a problem. I suppose there are some cases where controlled assignment isn't a good solution (I haven't seen one personally, but everything happens eventually...), but it seems like a niche need at best. Randy.