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 09:53:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.socal.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3D4C0ABA.F38204E3@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: 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> <3D4BCEC9.9030108@telepath.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 03 Aug 2002 16:53:53 GMT NNTP-Posting-Host: 66.74.216.166 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1028393633 66.74.216.166 (Sat, 03 Aug 2002 09:53:53 PDT) NNTP-Posting-Date: Sat, 03 Aug 2002 09:53:53 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:27657 Date: 2002-08-03T16:53:53+00:00 List-Id: Ted Dennison wrote: > > 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. Unless it's global to a package. I mean, if you never really need variable-length arrays, why did Ada95 include unbounded strings? Clearly there *is* a need for it. > > 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. OK, so when I said "you can't add one more element to the end of this array" and you said "yes you can", then you were mistaken. > > You can't do something like > > X := X & Y > > No, but you can easily do: > > declare > New_X : constant String := X & Y; Which doesn't help if the point is to change X. > > 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". Well, I'm not demanding anything. I'm quite happy working within the bounds of Ada when I need to use something Ada is strong at. I'm just trying to point out that saying "it's not there because you don't need it" is probably not going to get many people used to more convenient languages interested in Ada. > > Well, X idiom is kind of what we're talking about here. Of course Ada > It shouldn't be. In the sense that it was the OP's original question. Surely you can't mean "don't ask that question." > 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). I think how painful it is depends on what you're trying to do and how you're trying to do it. Personally, I see *no* relationship between X := X & A and declare new_X : blah := X & A I mean, wouldn't the same argument hold if someone said "Why doesn't language Blah have a while loop?" and you gave the answer "Well, the idiom in Blah is to use conditional gotos, which is not a royal pain." > > 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. Recursion is not always possible either, if other tasks need to be handled coherently, if (say) other tasks need to look at the value of the list while you're waiting for more input to come in, if you want to update a GUI based on the lines of text, if you're filling in the array based on the processing of a state machine (like a parser), etc etc. I.e., if you have something that's difficult to program in a functional style. > But as we said, that is something that will (hopefully) be corrected in > the next Ada revision. Yep. That would be nice. -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. ** http://images.fbrtech.com/dnew/ ** They looked up at me like I was a T-bone steak walking into an all-you-can-eat seafood buffet.