From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM, TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:e0c:: with SMTP id y12mr13481314qkm.109.1638469057833; Thu, 02 Dec 2021 10:17:37 -0800 (PST) X-Received: by 2002:a25:8804:: with SMTP id c4mr16564332ybl.148.1638469057679; Thu, 02 Dec 2021 10:17:37 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 2 Dec 2021 10:17:37 -0800 (PST) Injection-Info: google-groups.googlegroups.com; posting-host=84.92.86.82; posting-account=5K6RMgoAAADQeoHIOMi2dg5aYc0IVxGi NNTP-Posting-Host: 84.92.86.82 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: String Buffer From: Kevin Chadwick Injection-Date: Thu, 02 Dec 2021 18:17:37 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63186 List-Id: In this thread bounded and unbounded get quite a bashing. "https://groups.google.com/g/comp.lang.ada/c/NINmFln-YS4/m/5De5DeUAAAAJ" I thought bounded looked useful but then I realised that it allocates the m= ax immediately anyway. It may be useful in constrained environments but the= n I do not use Strings in constrained environments. Unbounded is said to be inefficient because it re-allocates. In Go they have strings.Builder. I assume that is what Text_Buffer is aimed= to be. (Actually Go seems to have copied a lot from Ada such as AWS API, u= nless they both are similar to something else like JAVA).=20 Is Text_Buffer usable today with GCC 11? strings.Builder in Go behaves similarly to unbounded in that it doubles the= allocation as required but it only returns a string when needed and does n= ot have string operations. You can Grow the builder to avoid re-allocations= . "https://pkg.go.dev/strings#Builder" If possible without breaking all of the string functions (length and separa= te capacity) and Unbounded Strings had a Grow function, then wouldn't that = relieve the efficiency issue? In any case avoiding unbounded strings is almost certainly in the realm of = premature optimisation most of the alleged 10% of the time that it useful, = but it would be nice to know of and use something akin to strings.Builder, = preferably from the standard library, if it is available?