Path: utzoo!mnetor!uunet!mcvax!enea!zyx!bd From: bd@zyx.UUCP (Bjorn Danielsson) Newsgroups: comp.lang.prolog Subject: End-of-file handling Message-ID: <2403@zyx.UUCP> Date: 24 Mar 88 06:49:23 GMT Reply-To: bd@zyx.SE (Bjorn Danielsson) Organization: ZYX Sweden AB, Stockolm, Sweden Lines: 22 I can't understand why there should be a "strait-jacket solution" to this kind of problem. Why not put in enough flexibility to allow for the most obvious cases? In Z-Prolog, (which was never designed to be Edinburgh compatible) the "read" predicate can handle end-of-file in three different ways, depending on an optional argument: (1) signal an error, (2) fail, (3) return a value supplied by the programmer. The default action is to signal an error. This solution, or something like it, could easily be adopted for Edinburgh Prolog as well, only the default there should probably be returning 'end_of_file' to ensure backward compatibility. End-of-file handling is much less problematic for character input, since there it is possible to have an end-of-file value (like -1) which can never be mistaken for legal input. -- Bjorn Danielsson, ZYX Sweden AB, +46 (8) 665 32 05, bd@zyx.SE