Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!mailrus!ames!pasteur!ucbvax!decvax!decwrl!sun!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: behavior of read/get0 at end_of_file Keywords: get0 read end_of_file Message-ID: <825@cresswell.quintus.UUCP> Date: 27 Mar 88 09:47:52 GMT References: <608> <1197@kulcs.kulcs.uucp> <783@cresswell.quintus.UUCP> <2412@zyx.UUCP> Organization: Quintus Computer Systems, Mountain View, CA Lines: 68 In article <2412@zyx.UUCP>, grzm@zyx.UUCP (Gunnar Blomberg) writes: > Well, considering the fact that nested comments can comment out > *any* part of the file, not just the last part, and that the cases > where nested comments do not work must be so exceedingly rare as to be > practically non-existent, I would definitely prefer nested comments. > Honestly, how often do you have unmatched beginning-of-nested-comment > of end-of-nested-comment buried inside your code? I see, it is ok to have an operation which works 99.9% of the time? It would be ok if "X is 1+1" almost always gave you the answer 2 but *might* give you 47? You would be happy to cross a ravine on a bridge which has been known to collapse before, but doesn't collapse often? I have found at least two C compilers where char *file_pattern = "/usr/me/foo/*"; broke because the pre-processor thought the /* was the beginning of a comment. Are you trying to tell me that a Prolog programmer writing for UNIX is never going to say file_pattern("/usr/me/foo/*"). and is never going to want to comment that out? Are you really? When I learned PL/I, the instructor stressed very strongly that we should never start a /**/ comment in column 1. Remember why? No doubt the JCL designers would have said "Honestly, how often do you have /* buried inside your data decks?". Perhaps I'm an old-fashioned fuddy-duddy, but it seems to me that an operation should ALWAYS do exactly what it is supposed to do, or else TELL you that it went wrong. {And yes, DEC-10 Prolog didn't live up to this, and no, I've never said that the standard should be identical to DEC-10 Prolog.} Yes, commenting file_pattern(...) out with PL/I-style comments isn't going to work either, but with PL/I-style comments you KNOW that there is no reason to expect it to work. Commenting it out with "%" WILL work. End-of-line comments are a much more reliable method of commenting out blocks of code than nesting comments, and are already part of the language. > Well, just because nested comments are much more useful than > plain ones does not mean that BSI should adopt them. There is the > question of supporting "old" code. It would be interesting to know > how many programs would break if Prolog comments were changed to be > nesting. Do you know of any? (1) BSI Prolog is going to break existing code in much worse ways than that. Old code written in ESI Prolog-2 stands a good chance of running under BSI Prolog, but old code written in Arity/Prolog has very little chance of getting away without massive changes. (2) The DEC-10 Prolog library broke when it was mounted under PopLog because PopLog used Modula-style comments and Edinburgh Prolog uses PL/I-style comments. (3) With a table-driven tokeniser, there isn't any reason at all why the Prolog standard can't make *BOTH* types of comment available. (4) If you think of "commenting-out" not as a matter of adding some characters at the beginning of a region and some other characters at the end, but as an operation on the entire region, you'll soon realise that you don't actually need nesting comments to be able to comment out a region that contains comments. For example, the editor I am using at the moment has commands Ctrl-X Ctrl-[ comment out the region using /* */ Ctrl-X Ctrl-] undo the effect of ^X^[ Works fine *even when nesting comments would break*, and I can use it in C as well as Prolog. (Actually, in Prolog I use a Meta-% command which uses "%".) So "much more useful" I take leave to doubt.