Frank Heckenbach wrote:
... snip ...
Fortunately, most I/O errors (e.g.) in Pascal are not signaled via function results in the first place.
I have always considered this an error in Pascals basic design, at least as far as things that do not fit the format are concerned. Consider: read(intvar); which has to cause an i/o error and usually program abort (barring other extensions) if the interactive input is not properly formatted. So I have always provided (as an extension) an alternative standard function: FUNCTION readx(something) : boolean; which returns true on a formatting error, and extends to reals, etc. just as does the normal read function. Unlike read, it cannot be used as shorthand for multiple reads. Thus interactive usage is normally: IF readx(something) THEN correctiveaction ELSE BEGIN (* all is well *) END; with the knowledge that the offensive character is in input^. Once readx is implemented, read is built by calling readx, except at the library level these are all specific closely typed functions, such as readxi. -- A: Because it fouls the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?