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=ham 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-08-02 19:04:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!intgwpad.nntp.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: FAQ and string functions References: <20020730093206.A8550@videoproject.kiev.ua> <4519e058.0207300548.15eeb65c@posting.google.com> <20020731104643.C1083@videoproject.kiev.ua> <4519e058.0208010629.5e6182ca@posting.google.com> <20020801194720.Q1080@videoproject.kiev.ua> <4519e058.0208020605.5ab7e092@posting.google.com> <3D4AAF63.72782659@san.rr.com> <3D4B2382.7030209@telepath.com> <3D4B2ACD.FDA29B9A@san.rr.com> User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: Date: Sat, 03 Aug 2002 02:04:50 GMT NNTP-Posting-Host: 144.132.42.132 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1028340290 144.132.42.132 (Sat, 03 Aug 2002 12:04:50 EST) NNTP-Posting-Date: Sat, 03 Aug 2002 12:04:50 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:27636 Date: 2002-08-03T02:04:50+00:00 List-Id: Darren New wrote: > No, I think the issue is (in part) when you say (for example) here's a > string, return me an array of strings, where each component of the returned > array is a whitespace-delimited work from the input string. So > Words("one two three four") > would return an array A such that > A[1] = "one", A[2] = "two", and so on. When i was writing Ada web based programs that split up text files, I ended up writing a set of string splitting functions, but they still retained a functional interface (i.e. Select_Field ("one two three", 2) would give "two'). Having a predefined type that i could dump the fields into would have been handy. I ended up writing some container code, which of course highlights the poverty of the standardised Ada offerings. > Sure. I think the problem is that there's a host of low-efficiency > operations in Perl that take advantage of built-in data structures. That Ada > offers fixed strings, bounded strings, and unbounded strings indicates that > it has a focus on efficiency that something like Perl doesn't. If Ada didn't > have unbounded strings, people would have to keep reimplementing it. As they constantly did with Ada83! > Ada > doesn't have unbounded arrays, and people have to keep reimplementing that > (when they need it). The assign-to-a-local-in-a-declaration doesn't really > work well when you have long-lived arrays. Ada -can- (sort of :-) have unbounded arrays, and it's not that hard to implement. e.g. type Unbounded_Array is array (Positive range <>) of Unbounded_String; and then... declare fields : Unbounded_Array := Split ("one two three"); begin ... Alternatively you return a pointer to the object, allowing it to be more long lived. Dale