From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Proposal: Auto-allocation of Indefinite Objects Date: Mon, 27 Jul 2020 17:48:40 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <94a54092-a56f-4a99-aaec-08dd611c8fd8@googlegroups.com> <8a502b6c-4609-4cd8-b292-5797fe6421e1n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 27 Jul 2020 17:48:40 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="39aff50e631596461bb81a9f099f71cc"; logging-data="12703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bzuA1M6sungC+OfXB+o46vRjB8JTgaMk=" User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a git.gnome.org/pan2) Cancel-Lock: sha1:IsT4PCwoeuSSTvJe7tIUtAUfgHA= Xref: reader01.eternal-september.org comp.lang.ada:59554 List-Id: On Mon, 27 Jul 2020 00:47:30 -0700, Yannick Moy wrote: >> My proposal is that it should (sometimes?) be possible to declare >> objects of indefinite types such as String and have the compiler >> automatically declare the space for them without the programmer having >> to resort to access types. In one sense we already have this ... in that we can do this in a Declare block, where stack allocation is a practical implementation. But what about cases where (for whatever reason) we want it allocated on the heap? In another sense we have it as JP Rosen said, for the specific example Unbounded_String. Is there any way we could generalise the (storage, access and lifetime aspects of) Unbounded_String for unconstrained arrays and discriminated records in such a way that Unbounded_String can be a simple instantiation of one of these? But without the full flexibility (or overhead) of controlled types. So, somewhere in between, as: 1. Controlled type | ---2.Unconstrained Array or Discriminated Record | ---3. Unbounded String (instance of 2) 2) can be implemented internally using pointers, but externally appears to be a data object, just like Unbounded_String does, with similar semantics. -- Brian