Waldek Hebisch wrote:
Scott Moore wrote:
- Integer field default appears to be "1".
This appears to indicate the default fields for integer is set to 1. This is technically valid, but clearly preverts the intent of the language. The "Pascal users manual and report" shows several examples of the field for integer being clearly set to the maximum size of integer. Ie., for a maximum integer of 11 digits including the sign (for +/-2147483647) the default should be 11 digits for integer. The output of numbers in collumns under the assumption that they would correctly spaced for all integers would fail under the current GPC (see again the several examples in the "report"). I have had the discussion with another implementor, and this treatment of defaults falls under "techically valid (by the ISO 7185 standard), but would break examples of the original Pascal as formulated by Wirth", which I consider a quality issue.
Actually you've had the same discussion with us. :-) Output in columns is one thing, output in text form (Writeln ('There are ', n, ' items.')) is another thing. The spaces that are useful in the former case are annoying in the latter case, and having to write ": 11" in the former case is just as cumbersome as having to write ": 1" in the latter case. Now, we can argue about which use is more common (AFAICT, today, the latter, by orders of magnitude; might have been different in the 1970's) or more important (which is a matter of opinion). So I consider it preferences rather than quality.
So the best GPC can and should do is to provide both options. In case it wasn't mentioned before, the respective options are called:
--field-widths
--no-field-widths
and even:
--field-widths=10:20:30:40:50
to set your own defaults for Integers, long Integers (nonstandard), Booleans, Reals and long Reals (nonstandard).
"--field-widths" is the default in --classic-pascal (AKA --standard-pascal), even though not strictly required by the standard, and those who like this behaviour in non-standard mode can just use this option.
- Boolean outputs nonstandard.
There is no explaination for the values of boolean. Since they are treated as the strings "true" or "false", there is no possible default field that would deliver the results shown. If the default were 5 (size of 'false') the result would be:
True
(Only one space here, I'd say.)
False
For 4 (size of 'true') it would be:
True Fals
Playing language lawyer ...
6.9.3.1 says: "[...] a default value for TotalWidth that depends on the type of e; [...]".
But 6.9.3.6 explains how for string-types, the default value of TotalWidth depends on the value.
Therefore the statement in 6.9.3.1 cannot be understood as exclusive, i.e. "depends on the type of e *only*". At least in the case of string-types it depends on the type and the value, so the same statement cannot exclude this as a possibility for other types.
6.9.3.1 goes on: "[...] for integer-type, real-type, and Boolean-type, the default values shall be implementation-defined". But I find no statement in the standard that requires implementation-defined to mean a constant value.
Anyway, even if we accept your interpretation, it would mean that there is no straightforward way to print Booleans in "text form" (i.e.: Writeln ('The value of MyBool is ', MyBool : n, '.')) for any constant n without spurious spaces. (The simplest way might be substituting "5 - Ord (MyBool)" for n, which is a little unintuitive IMHO. ;-) Whereas with GPC's default behaviour it's still easy to produce tabular output by adding ": 6". Otherwise the same points as above apply.
I tried this also with the "--standard-pascal" flag on (by commenting out the error causing statements), and got the same result.
Again, this used to pass.
- Last line in file without "eoln" not corrected as required by standard.
IIRC the promise was that this will work with "--standard-pascal". I belive that there was no intent to change default behaviour.
Indeed, there was and is no intent to do so.
Again, we could discuss opinions here. There are practical reasons for GPC's default behaviour (as an example I could name my text editor, written in GPC, which I want to be able to distinguish files with and without trailing end-of-lines; with Standard Pascal textfiles, this simply wouldn't be possible, whereas the opposite is easily possible in GPC mode). So we chose the more flexible option by default, and the strictly standard-conforming option only in standard mode.
Frank