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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Proposal: Auto-allocation of Indefinite Objects Date: Fri, 21 Aug 2020 08:46:07 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <94a54092-a56f-4a99-aaec-08dd611c8fd8@googlegroups.com> <8a502b6c-4609-4cd8-b292-5797fe6421e1n@googlegroups.com> NNTP-Posting-Host: 2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59774 List-Id: On 21/08/2020 01:30, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:rhmd3m$1eql$2@gioia.aioe.org... >> On 20/08/2020 02:10, Randy Brukardt wrote: >>> "Dmitry A. Kazakov" wrote in message >>> news:rgr267$1o1n$1@gioia.aioe.org... >>>> No, from the abstraction point of view they do not. They indeed abstract >>>> the memory allocation aspect, but they do that at the cost of >>>> *everything* >>>> else. Unbounded_String is no string anymore. Container is neither array >>>> nor record type. Unbounded_String must be converted forth and back. For >>>> containers I must use ugly hacks like iterators to make them resemble >>>> arrays and records introducing whole levels of complexity to fight >>>> through >>>> every time the compiler or I miss something. >>>> >>>> In most cases I prefer to keep a clear array or record interface at the >>>> expense of manual memory management. >>>> >>>>> There's no free lunch. >>>> >>>> I think with a better type system there could be a whole banquet. (:-)) >>> >>> Maybe. but IMHO a better type system would get rid of arrays and strings >>> altogether and only have containers/records of various sorts. The >>> complexity >>> of having both solving the same problems (not very well in the case of >>> arrays/strings) doesn't buy much. I suspect that a user-defined "." as >>> you've proposed elsewhere would eliminate most of the rest of the >>> problems >>> (and unify everything even further). >> >> But records and arrays are needed as building blocks of containers. How >> would you get rid of them? > > There's no reason that a compiler couldn't "build-in" a simple bounded > vector container as the basic building block. That simply replaces the word "array" with four words "simple bounded vector container." The construct is still there and it is still built-in. The syntax and usability are drastically worse, though. > One could do something similar for records, although I would probably leave > them as in Ada and just allow user-definition of "." (via a getter/setter > pair). Ditto. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de