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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.16 $; site ada-uts.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!ada-uts!stt From: stt@ada-uts.UUCP Newsgroups: net.lang.ada Subject: More comments on Ada Text_IO Message-ID: <4700010@ada-uts.UUCP> Date: Thu, 19-Sep-85 18:44:00 EDT Article-I.D.: ada-uts.4700010 Posted: Thu Sep 19 18:44:00 1985 Date-Received: Sun, 22-Sep-85 06:19:05 EDT Nf-ID: #N:ada-uts:4700010:000:2571 Nf-From: ada-uts!stt Sep 19 18:44:00 1985 List-Id: I have found OUTPUT using Text_IO quite adequate. My major gripe is that they have made no provision for controlling when the output REALLY goes to the external file/device (i.e. ability to request a buffer flush). Text_IO Input is an implementer's nightmare, if you want it to be usable on an interactive terminal, while still following the correct semantics w/r/t end-of-line, end-of-page, end-of-file, line numbers, etc. The solution we have adopted is essentially a "lazy" evaluation of all interesting state information, until the user actually requests it. So, the rule that when skipping an end-of-line marker, you should skip an immediately following end-of-page marker, is deferred until the user actually asks about end-of-page, or asks the line number, or asks for another character. The "obvious" implementation would have the effect of stopping the program at the end of each line of input, waiting to find out whether the user will type an end-of-page marker next. Because the implementation does not follow intuitively from the specification, I have the feeling that the input "model" is still not right, and still suffers from its Pascal heritage. Since Ada has adopted the ASCII/ISO character set, it would have been reasonable to simply specify the characters to be used to represent end-of-line and end-of-page. A LOOK_AHEAD routine should have been defined, which returned the character which followed (without advancing past it), independent of whether it was a graphic character or a control character, as well as returning a boolean to indicate end-of-file. A SKIP_CHAR routine should have been provided to advance past it. Then END_OF_LINE, END_OF_PAGE, and END_OF_FILE could have been defined and implemented in terms of LOOK_AHEAD. Finally, the need for multiple look-ahead should have been removed. End-of-page would be true only if the next character were an end-of-page marker. End-of-file would be true only if there were no next character. A single character LOOK_AHEAD is all that most lexers need, and providing it in TEXT_IO would have eliminated an extra layer of hassle. For record-oriented systems, an end-of-line marker character should have been specified to be substituted for end-of-record. Instead, Text_IO seems to be attempting to accomodate both stream-oriented and record-oriented views, which cripples it. Stream-oriented is much more flexible, and the model should have been consistently stream-oriented. S. Tucker Taft (617) 661-1840 inmet!ada-uts!stt c/o Intermetrics 733 Concord Avenue Cambridge, MA 02138