comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Converting Type Characters to type string
Date: Mon, 31 Mar 2008 11:59:30 +0200
Date: 2008-03-31T11:59:34+02:00	[thread overview]
Message-ID: <a0nvn55f13ky$.1bh5ht75bwx9.dlg@40tude.net> (raw)
In-Reply-To: 2d291584-9cb9-4a3f-8626-7b7066e60566@59g2000hsb.googlegroups.com

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



  reply	other threads:[~2008-03-31  9:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-30 20:04 Converting Type Characters to type string jedivaughn
2008-03-30 20:19 ` Pascal Obry
2008-03-30 21:08   ` jedivaughn
2008-03-30 21:28     ` jimmaureenrogers
2008-03-30 21:38     ` Ludovic Brenta
2008-03-30 21:48   ` Georg Bauhaus
2008-03-30 23:52     ` jedivaughn
2008-03-31  3:04       ` george.priv
2008-03-31  4:00         ` tmoran
2008-03-31  8:54           ` Ludovic Brenta
2008-03-31  9:59             ` Dmitry A. Kazakov [this message]
2008-03-31 10:59               ` Jean-Pierre Rosen
2008-03-31 13:50                 ` jedivaughn
2008-03-31 14:11                   ` Ludovic Brenta
2008-03-31 14:21                   ` Dmitry A. Kazakov
2008-03-31 14:44                     ` jedivaughn
2008-03-31 15:41                       ` Adam Beneschan
2008-03-31 20:26                         ` Maciej Sobczak
2008-03-31 22:06                           ` Georg Bauhaus
2008-03-31 22:33                           ` Adam Beneschan
2008-04-01  1:00                             ` jedivaughn
2008-04-01  5:34                               ` Simon Wright
2008-04-01 11:22                                 ` jedivaughn
2008-04-01 12:00                                   ` jimmaureenrogers
2008-04-01 13:22                                     ` jedivaughn
2008-04-01 17:03                                       ` Adam Beneschan
2008-04-01 21:11                                   ` Simon Wright
2008-04-01 22:22                                     ` jedivaughn
2008-04-03  5:54                                   ` tmoran
2008-04-03 14:38                                     ` Adam Beneschan
2008-04-01 16:58                               ` Adam Beneschan
2008-03-31 15:45                       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox