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,cbb87dd49168c396 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-31 09:54:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Message-ID: <3DC16AB7.7080905@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Get_Line References: <3DBF3659.30709@acm.org> <4dRv9.46453$wm6.7691@nwrddc01.gnilink.net> <3DC0204E.4050203@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 31 Oct 2002 12:39:03 -0500 NNTP-Posting-Host: 198.96.47.195 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1036085957 198.96.47.195 (Thu, 31 Oct 2002 12:39:17 EST) NNTP-Posting-Date: Thu, 31 Oct 2002 12:39:17 EST Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:30264 Date: 2002-10-31T12:39:03-05:00 List-Id: Robert A Duff wrote: > "Chad R. Meiners" writes: > > >>"Robert A Duff" wrote in message >>news:wcc3cqn35wu.fsf@shell01.TheWorld.com... >> >>>But isn't the *real* problem that the design of Text_IO is broken? For >>>example, why is there no Get_Line function: >>> >>> function Get_Line(...) return String; >>> >>>that returns the entire contents of the next line, no matter how long it >>>is, and without fussing about with fixed-length (i.e. wrong length!) >>>buffers? >> >>I wouldn't say broken. > > > Why not, given that beginners have trouble with all that buffer > management? In fact, so do experts! How does one choose the correct > buffer size? > > Whether or not you like my Get_Line idea, surely you must admit that > beginners and experts are troubled by the current Text_IO interface. > > >>... Do you really want Ada.Text_IO to contain functions >>with side-effects? I would say no -- at least as much as is practical. Consider a different interface: with Ada.Strings.Unbounded; ... declare use Ada.Strings.Unbounded; Line : Unbounded_String; begin ... Get_Line(F,Line); -- Non-standard Get_Line() here Here Line can be returned as short or as long as required. If you later want a "native string", then add: declare S : String := To_String(Line); begin ... -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg