According to Phil Nelson:
According to myself (Peter Gerwinski):
(*** Does anybody know how UCSD behaves here? I don't want to dig out my old Apple //e in order to check this. ***)
Yes, it clips strings and it has a 10 for the default field size.
Meanwhile I digged out my UCSD Pascal *documentation*, and it says that UCSD Pascal has a default width of 1, but it clips strings. I did not verify this on the Apple //e, but if the default width would have been something different from 1, I would remember it now.
Borland is the only Pascal compiler that I have used or heard of that does not clip strings and uses 1 as the default field size. Does someone know of another one (besides gpc)?
Yes, almost every Pascal compiler I know for the PC. I checked it for FPK Pascal and Virtual Pascal: Both have a default width of 1 and don't clip strings. I cannot check it now, but I am sure that Speed Pascal, MS Quick Pascal, and TMT Pascal behave in the same way.
Anyway, we should count programmers and source lines, not compilers. AFAIK Borland Pascal has more users than all other existing Pascal compilers together. This does, of course, not mean that Borland's way is the best one, but it means that we must not ignore Borland Pascal.
The above does not clarify how GPC's default behaviour should be.
It should be ISO Pascal with the de-facto-standard field widths.
Why?
IMHO Borland's method is more logical than what most Standard Pascal compilers do.
It may be more logical, but we didn't design the language.
We *are* designing a language.
I already wrote some weeks ago:
It is desirable to comply to existing standards, but I don't consider this compliance as an end in itself. [...]
The current design of GPC is to integrate the good features from the many existing Pascal standards, and you can restrict GPC to these standards using compiler switches:
--standard-pascal-level-0 Should work --standard-pascal Do conformant arrays work now? --extended-pascal Not yet fully implemented --object-pascal Just started --ucsd-pascal Almost complete --borland-pascal Almost complete --delphi Just started --pascal-sc Just started
The default should be the most powerful easy-to-use and easy-to-understand compiler which can be constructed out of these standards plus GNU extensions. This is in the spirit of GCC; `info gcc invoking "warning options"' says:
We recommend [...] that users take advantage of the extensions of GNU C and disregard the limitations of other compilers. Aside from certain supercomputers and obsolete small machines, there is less and less reason ever to use any other C compiler other than for bootstrapping GNU CC.
If it is possible to have something better (in this case: more logical) than most Standard Pascal compilers, this better solution should be the default, and there must be a compiler switch to emulate those other compilers.
And, anyway, we are talking about a default width of 1, not about string clipping, so this would not even violate the ISO Standard.
[...]
I can not live with either being the standard behavior. If you do make Borland behavior standard, at least make it a configure option to not make Borland behavior standard so I don't have to maintain local changes to gpc to get what I really want. Similarly, if you choose to make Standard Pascal the default behavior, have a configure option to choose Borland for those who want it. Better yet, make gpc change depending on whether it is run as gpc (Standard Pascal) or bpc (Borland Pascal).
I never intended to make GPC's standard behaviour to emulate Borland Pascal, but I also don't intend to restrict GPC by default to the ISO Standard. GPC shall be something superior to both Borland Pascal and ISO Pascal.
It is a very good idea to make GPC's behaviour depending on the name it is invoked with. What about the following:
pc ISO 7185 Standard Pascal compiler epc ISO 10206 Extended Pascal compiler bpc Borland Pascal compatible compiler ... (other de-jure or de-facto standards) gpc Integrate all good features (not the misfeatures) of these standards in one compiler.
People who need compatibility to other ISO Extended Pascal compilers will invoke GPC as `epc' and will not notice any Borlandish behaviour. (If they do, the may report it as a bug.) Vice versa, those who want a "32-bit Borland Pascal" will call GPC as `bpc'. Those who call GPC as `gpc' will profit from both (and more) dialects.
One typical example is to allow components of structured variables as `for' loop control variables (according to Borland). This is a harmless extension to the ISO Standard - nobody will use this unintentionally -, so `gpc' will accept it. (`epc' will not.) Now we can combine this with Extended Pascal's set member iteration (to be implemented soon):
for i [ k ] in [ 2, 3, 5, 7, 11 ] do ...
I intend, for example, to combine Extended Pascal's schema types with Borland Pascal's object types.
- When an Integer value is being output with a field width of zero, output is suppressed. Is this ISO Standard (doesn't seem so), or a bug?
This is not conforming and needs to be changed. It should be the same as 1.
Okay, I will be happy to change this.
- When a Real value is being output with a too narrow field width, other compilers bother to make the output as short as possible. Should GPC do the same?
It should follow 6.9.3.4.1 (ISO 7185) [...]
Okay, I'll take care of that. (Although I wouldn't mind if somebody else would hack the runtime library for such things, so I can face schema types instead ...)
[blank in front of Reals]
Yes, they are following the standard. I have no problem with the switch as long as it is not standardly on.
Okay. It will be "off" by default.
Is it possible we should ask Juki what the standard behavior should be? Borland vs Standard?
Since Juki is on this list, he should read all this. Hey, Juki, what's your point of view?
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970401] - http://home.pages.de/~gnu-pascal/ [970125]