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-30 16:44:40 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Get_Line User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Thu, 31 Oct 2002 00:44:19 GMT Content-Type: text/plain; charset=us-ascii References: <3DBF3659.30709@acm.org> <4dRv9.46453$wm6.7691@nwrddc01.gnilink.net> <3DC0204E.4050203@acm.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30243 Date: 2002-10-31T00:44:19+00:00 List-Id: "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? Yes, given that that's the usual way in Ada to return an arbitrary-length string. > Put_Line (Get_Line & Get_Line); -- Do you want to encourage this in the > standard? I don't think a Get_Line function *encourages* that. I just want to allow: X: constant String := Get_Line... ---- By the way, if you're phobic of side effects, why do we have "X := new T;" (in Ada) instead of "new(X);" (as a statement in Pascal)? The "new" clearly affects (or causes side-effects upon) the heap. Does this "encourage" things like "if new T = new T then.."? - Bob