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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!reality.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Question on bounded / unbounded strings Date: Wed, 28 Sep 2016 16:09:37 -0500 Organization: JSA Research & Innovation Message-ID: References: <11ee98f5-d373-4c72-8562-c310cc76817d@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1475096956 5824 24.196.82.226 (28 Sep 2016 21:09:16 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 28 Sep 2016 21:09:16 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Xref: news.eternal-september.org comp.lang.ada:31932 Date: 2016-09-28T16:09:37-05:00 List-Id: "John Smith" wrote in message news:e60176b6-4c61-474a-a191-b31821816004@googlegroups.com... On Saturday, September 24, 2016 at 3:52:54 AM UTC-4, Dmitry A. Kazakov wrote: ... > However, if I ever need string functionality that I'm used to in Python or > C++, Ada doesn't have it (sadly). I used to tell people to use Unbounded_Strings, but that was before I tried to build an application that way. (I discussed that further in a different message in this thread). You have to revert to String in many places (which is aggrevating [Ada 2005 did eliminate a couple of them, but it doesn't help much], one has to look up the names of the operations beyond the most basic, and if you are sensible use-adverse person (:-)), the names you have to use are nasty (Ada.Strings.Unbounded.To_Unbounded_String ("Foo") -- gack!!!) To get that Python functionality in Ada, you have to be willing to stand on your head, and once you are willing to do that, you might as well use String for most everything other than storage of variable-lengthed strings. (And it's not that hard to do the latter for String as well, but that gets into manual storage management that everyone gets wrong.) All of the operations of Unbounded_String are also available in Ada.Strings.Fixed (unless, of course, they're builtin operations like indexing and slicing), so there's no need to reinvent most of those wheels. Randy. Unbounded strings are the only reasonable solution. Yes, I can work have fixed size strings do the same, but then I will have to craft needlessly complex logic to accomplish the same thing. If someone else (or me) needs to spend more time than is necessary in order to understand what I'm doing in my source, then it is an indication -- usually -- that either my design or implementation is flawed (and as we know, perception is reality, especially to humans.)