Hello folks,
I think it's time to discuss about the purpose of GNU Pascal as stated
by Juki (jtv) in GPC.GUIDE. More concrete: I disagree with some points
and I would suggest to modify them.
jtv> The purpose of the GNU Pascal project is to produce a
jtv> Pascal compiler (called GNU Pascal or gpc) which
jtv> - may be distributed under normal GNU license conditions
jtv> - can genarate code and run on any computer for which the GNU C
jtv> compiler can genarate code and run.
Concerning the points above, I agree in complete.
jtv> - supports both the Pascal standard and the Extended Pascal
jtv> standard as defined by ISO and ANSI and IEEE.
jtv> (ISO 7185:1990, ISO/IEC 10206:1991, ANSI/IEEE770X3.160-1989)
It is okay and desireable to support these standards, but I wouldn't
agree to obey the standards "come what may".
As far as I would guess, 80% of all Pascal programmers are working with
Borland Pascal or Delphi or a compatible system like Virtual Pascal,
Speed Pascal, FPK Pascal, GNU Pascal or one of those ShareWare Pascal
compilers written for the DOS platform. On the other side I know
of only two Extended Pascal compilers: Prospero's Extended Pascal and
GNU Pascal. So I call in question that Extended Pascal is more portable
than Borland Pascal. Furthermore, I could not write my real-world programs
just with Extended Pascal; I need, for example, bit shift operators, GetMem,
FreeMem, and Objects.
I think the way to go is to collect the good features of all the existing
standards, ISO 7185, ISO 10206, Borland Pascal, Object Pascal, Pascal-SC,
and integrate them in one powerful compiler which will set up the next
standard. This is necessary, in my opinion, because *none* of the standards
mentioned above is what I would call an "ideal" Pascal compiler by itself.
I would be satisfied only with the *combination* of them. Apart from
some bugs, the current version 1.1-2.6.3 of GNU Pascal is the best Pascal
compiler I have ever seen, and we are not too far from making it even
better.
jtv> One reason for this is the desire to promote the use of Extended
jtv> Pascal, which combines the clarity of Pascal with powerful
jtv> tools (e.g. modules and string manipulation) suitable for real-life
jtv> programming. Pascal was originally designed for teaching.
jtv> Extended Pascal provides a smooth way to proceed to challenging
jtv> programming tasks without learning a completely different language.
The same holds for Borland Pascal. (In my opinion, the goals stated above
are even better realized in Borland Pascal, but that's a matter of taste.)
And there are other standards around, for example Pascal-SC (also named
PXSC -- Pascal eXtensions for Scientific Calculations) with very useful
features such as user-definable operators and procedure overloading.
I would suggest to fix the goal of combining the clarity of Pascal with
powerful real-life tools -- independently of a concrete standard.
So my suggestion for the "Purpose" section of GPC.GUIDE would begin with:
The purpose of the GNU Pascal project is to produce a
Pascal compiler (called GNU Pascal or gpc) which
- combines the clarity of Pascal with powerful tools suitable
for real-life programming,
- supports both the Pascal standard and the Extended Pascal
standard as defined by ISO, ANSI and IEEE (ISO 7185:1990,
ISO/IEC 10206:1991, ANSI/IEEE 770X3.160-1989),
- supports other Pascal standards (UCSD Pascal, Borland Pascal,
Pascal-SC) in so far as this serves the goal of clarity and
usability,
- may be distributed under normal GNU license conditions,
- can generate code and run on any computer for which the GNU C
compiler can generate code and run.
Pascal was originally designed for teaching. GNU Pascal
provides a smooth way to proceed to challenging programming
tasks without learning a completely different language.
jtv> GNU Pascal compiler is part of the GNU Compiler family
jtv> combining a language independent part of the GNU Compiler with
jtv> a Pascal specific front end.
jtv>
jtv> Other compilers of the family currently include compilers for
jtv> the C, C++ and Objective C languages.
Since this is true, we should compare the purpose of GNU Pascal with
that of GNU C. In the section "Warning Options" of the GNU C info
documentation (gcc), in the context of the "--pedantic" option which
tells GCC to follow the ANSI standard as strictly as possible, we can
find the following:
gcc> A feature to report any failure to conform to ANSI C might be
gcc> useful in some instances, but would require considerable
gcc> additional work and would be quite different from `-pedantic'. We
gcc> recommend, rather, that users take advantage of the extensions of
gcc> GNU C and disregard the limitations of other compilers. Aside
gcc> from certain supercomputers and obsolete small machines, there is
gcc> less and less reason ever to use any other C compiler other than
gcc> for bootstrapping GNU CC.
In the same spirit I would suggest: Implement all reasonable extensions
into GNU Pascal, encourage their use, and forget about the limitations of
other compilers (such as UCSD or Borland Pascal) or standard definitions
(such as Standard Pascal or Extended Pascal).
jtv> ABOUT THE PASCAL AND EXTENDED PASCAL LANGUAGES
jtv> ----------------------------------------------
jtv>
jtv> [...]
jtv>
jtv> Extended Pascal is a standardized language which contains so
jtv> significant extensions to Pascal that it is best regarded as
jtv> a new language. It is currently not very well known, and computer
jtv> vendors do not seem to be eager to provide compilers for it.
jtv> Thus, there is social need for GNU Pascal supporting Extended
jtv> Pascal.
It is okay to support Extended Pascal (why not?), but in my opinion,
Extended Pascal is not clear and powerful enough to serve as "the new
Pascal standard", so programmers are not motivated to switch from
Borland Pascal to Extended Pascal. I think, this is the reason why
computer vendors do not provide Extended Pascal compilers.
As far as I have understood, the committee which defined the standard
knew Borland Pascal, so I simply cannot understand how they could define
a standard which lacks some important features of existing compilers,
for example the bit-shift operators or dynamical memory allocation with
user-specified size (GetMem and FreeMem). There is social need for a
*new* standard which integrates ISO 10206 Extended Pascal and other
standards such as Borland Pascal and Pascal-SC. With GNU Pascal, we
can *create* that new standard.
For those who like standards: I suggest to implement compiler switches
into GNU Pascal which force GPC to behave (inasmuch as possible) like
a compiler of the specific standard, for example
--standard-pascal for an ISO 7185 Standard Pascal compiler
--extended-pascal for an ISO 10206 Extended Pascal compiler
(which rejects Borland extensions)
--borland-pascal for emulating the Borland Pascal compiler
(which rejects Extended Pascal extensions)
--pascal-sc for emulating a Pascal-SC compiler
(not yet possible)
but the default should be to accept *all* of the Pascal dialects and
any combination of them, for example a Borland-style Unit which deals
with Extended Pascal complex numbers and exports a Pascal-SC-style
operator for matrix multiplication. (You actually can write such a
thing with the current version of GNU Pascal!)
jtv> Please refer to the document borland2ep.doc to find out more about
jtv> the differences between Turbo Pascal and Extended Pascal.
jtv> That document is written by Berend de Boer.
I wrote another document about the same topic. It is somehow obsolete
since GNU Pascal now understands most of the Borland Pascal language,
but nevertheless you can find it at
ftp://agnes.dida.physik.uni-essen.de/gpc-2.6.3/bp2ep.doc
I am looking forward for reactions.
Yours,
Peter