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-Thread: 103376,37c1f61bd0b7914 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.germany.com!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Converting Type Characters to type string Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <8f5967a7-17ab-4eda-80fc-5cb58ae011f5@s50g2000hsb.googlegroups.com> <2d291584-9cb9-4a3f-8626-7b7066e60566@59g2000hsb.googlegroups.com> Date: Mon, 31 Mar 2008 11:59:30 +0200 Message-ID: NNTP-Posting-Date: 31 Mar 2008 11:59:34 CEST NNTP-Posting-Host: cd6f52f8.newsspool1.arcor-online.net X-Trace: DXC=2c2@c8D>>jYYI9]OHn9o5^ic==]BZ:af^4Fo<]lROoRQ8kF On Mon, 31 Mar 2008 01:54:24 -0700 (PDT), Ludovic Brenta wrote: > As a matter of general principle, I always use a for loop when > traversing an array: > > procedure Get_Digits (Result : out String; Last : out Natural); > -- Reads at most Result'Length characters from standard input. Stops > -- after the first character that is not a decimal digit. > -- On output, Result (Result'First .. Last) contains the digits from stdin; > -- Last may be zero, indicating no digits entered (i.e. one character that > -- is not a digit was read). (or none, on End_Error, Data_Error etc) Such Get_Digits is not composable, without a sort of "unget," which Ada.Text_IO does not have. I believe it was a bad (FORTRAN?) idea to intermix I/O with parsing / syntax analysis. Though it had one theoretical advantage of being able to deal with lines of an unlimited length, in real life that never worked anyway. (Like in your example, it would not). -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de