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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f316de357ae35e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-31 00:55:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.rt.ru!rt.ru!newsfeed.gamma.ru!Gamma.RU!carrier.kiev.ua!news.lucky.net!not-for-mail From: Oleg Goodyckov Newsgroups: comp.lang.ada Subject: Re: FAQ and string functions Date: Wed, 31 Jul 2002 10:46:43 +0300 Organization: unknown Distribution: world Message-ID: <20020731104643.C1083@videoproject.kiev.ua> References: <20020730093206.A8550@videoproject.kiev.ua> <4519e058.0207300548.15eeb65c@posting.google.com> Reply-To: og@videoproject.kiev.ua NNTP-Posting-Host: news.lucky.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.lucky.net 1028102103 6908 193.193.193.102 (31 Jul 2002 07:55:03 GMT) X-Complaints-To: usenet@news.lucky.net NNTP-Posting-Date: Wed, 31 Jul 2002 07:55:03 +0000 (UTC) X-Return-Path: oleg@videoproject.kiev.ua Xref: archiver1.google.com comp.lang.ada:27508 Date: 2002-07-31T10:46:43+03:00 List-Id: On Tue, Jul 30, 2002 at 06:48:43AM -0700, Ted Dennison wrote: > There is all sorts of stuff like that in the Ada.Strings.* packages. > See section A.4 of the online LRM at > http://adaic.org/standards/95lrm/html/RM-TOC.html . More generally, > read *everything* in Annexes A and K before asking any more "does Ada > have XYZ?" questions. I've read it before asked. Moreover, I've asked because read it. > Strings in Ada are particularly tricky for newcommers. One trap is > underuse of perfectly sized string constants. Most strings get their > value once and never need it changed. If that is the case, its fairly > easy to declare the string at the point its value is known, with the > perfect bounds, by using a string constant (possibly inside a > "declare" block). If you do that, it becomes very easy to deal with. Thanks a lot. But it is not my case. > Also, note that a lot of string handling stuff that requires routines > in other languages is trivial in Ada. For instance, you can take a > slice of any array (including strings) with something like > "Array_Name(5..8)". Any two arrays of the same type (including > strings) can be concatenated with "&". Most numeric types (and > enumerations) can be converted to strings with the 'image attribute. All of that I know. And all of that is very inconvinience to handle of strings. In Booch components set in demo files is present file bcwords.ada. Look at it. It contains full program for counting and printing of frequencies of words met in any given text file. But this file - bcwords.ada - begins from 15-line Perl's program, which does the same work. Look there, compare volumes of Perl's and Ada's programs, and think, why difference is so dramatically big in favor of Perl? If we look at that Ada program carefully, we'll see, that half of it takes subprogram Get_Next_Word. What it does? It's clear from name - it parses next word from line. How it is done in Perl program? Simple - by splitting of line on words by space as delimiter. So, while on Ada we must make slice, "Array_Name(5..8)", loop, if, and other very important stuff, in Perl we say @list=split(/ /,String) and that's all. Is this Perl's own especiality? No. It can be realized in Ada. And I say more - without this Ada will never be convinient language. While for splitting string like "x=2*3" people will must be to write program enstead split("=","x=2*3"), people will write in Perl, not Ada. So, by all of diversity of GENERIC string's handling tools in Ada, convinient tool is not present.