Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ncsu.UUCP Path: utzoo!linus!decvax!mcnc!ncsu!mauney From: mauney@ncsu.UUCP (Jon Mauney) Newsgroups: net.lang.c,net.lang.pascal Subject: Re: Language transitions Message-ID: <2798@ncsu.UUCP> Date: Mon, 18-Feb-85 10:08:45 EST Article-I.D.: ncsu.2798 Posted: Mon Feb 18 10:08:45 1985 Date-Received: Wed, 20-Feb-85 20:27:19 EST References: <252@gumby.UUCP> <535@ukma.UUCP> <258@gumby.UUCP> <4475@ucbvax.ARPA> <590@ncoast.UUCP> <2793@ncsu.UURe: Language transitions Organization: N.C. State University, Raleigh Lines: 32 Xref: linus net.lang.c:3871 net.lang.pascal:244 I say: >> Of the many flaws in Pascal, ordinary I/O is not one. There is nothing >> preventing good interactive execution of Pascal programs. Except (staying within the semantics of J&W, of course!): > > 1) Getting read/write to work as expected on an interactive system. I've > heard that it can be done right while still maintaining the J&W semantics, > but have never seen it so done. > > 2) Doing the *exact* equivalent of printf("Gimme data: "); with the > cursor left at the end of the line. The trick is to do lazy evaluation on input, and to be careful how you buffer the output. The definition of I/O in J&W is very simple, concerning itself with contents of the file pointer and the values of the eof and eoln flags. Despite what the implementers of UCSD Pascal seem to think, it is not necessary to get the next input character until the code actually tries to use it. Berkeley's Pascal compiler does lazy evalution of input, and it works just fine; about the same as C, in fact. As for write('Gimme The Ax: '); J&W say nothing about buffering the output, so there is nothing to prevent write statements from having an immediate effect. I have written interactive programs in Pascal, and they conform to a reasonable interpretation of Jensen and Wirth. -- *** REPLACE THIS LINE WITH YOUR SIGNATURE *** Jon Mauney mcnc!ncsu!mauney C.S. Dept, North Carolina State University