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-03 05:41:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!west.cox.net!cox.net!p01!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D4BCEC9.9030108@telepath.com> From: Ted Dennison User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 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> <3D4B401E.3060802@telepath.com> <3D4B4477.500088B@san.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 03 Aug 2002 12:41:28 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1028378488 68.12.51.201 (Sat, 03 Aug 2002 08:41:28 EDT) NNTP-Posting-Date: Sat, 03 Aug 2002 08:41:28 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:27647 Date: 2002-08-03T12:41:28+00:00 List-Id: Darren New wrote: > Tell me how you declare a variable for an array whose bounds you don't know > until after you're past the declaration? That's not what you said before. Its also a nearly irrelevant point, since you can almost always place declaration at the point where you *do* know the length. > Tell me how you add more elements to the end of an array? In Ada the idiom isn't to add elements to the end of an existing array; its to build a new one with the two old arrays catenated. If this needs to be done progressively, one uses recursion. Of course that can be real slow. But if you care that much about speed, typically you'd want to be using your own bounded-style algorithms anyway. It might be nice to have some middle-speed-ground in there using dynamic allocation too. Hopefully the new list support in Ada0X will help out there. > You can't do something like > X := X & Y No, but you can easily do: declare New_X : constant String := X & Y; > > Yes, actually, it can be a huge hardship, if that's how you think about > things. If you've got a variable of global lifetime (or whatever Ada calls We're back to my earlier point: Perhaps you should change how you think about things, rather than demand we "move the mountain to Mohhamed". You can't expect every language to support every idiom every other language supports. If you go into Lisp trying to program it like Perl, you won't have much fun either. > Well, X idiom is kind of what we're talking about here. Of course Ada It shouldn't be. If you can do the same tasks Idiom X is used for in Ada with idiom Y, and idiom Y isn't a royal pain comparativly, then I don't see a problem (except perhaps with training). > But this works poorly in many places where, for example, you want to > accumulate a bunch of results into an array. Like, I want to read lines from > the terminal into an array of strings until I get a blank line. Only if you refuse to use recursion. Note that the original list processing language (LISP) has variable length arrays (lists) as its basic data type, and it still encouraged using recursion for these kinds of tasks. But as we said, that is something that will (hopefully) be corrected in the next Ada revision.