CURRENT NOTES MARCH 1988 P R O S P E R O P A S C A L V . 2 Yes, Virginia, This Time They've Got It Right! Review by J. Andrzej Wrotniak The original Version 1 of Prospero Pascal (see CURRENT NOTES of May and June, 1987) was a solid mainframe-type implementation crippled by lack of a convenient (or almost any worth speaking of) user interface, practically no description of GEM bindings and few other things. Then Prospero announced plans to release the next version, with all the bells and whistles, tons of documentation, and lots of other improvements. The long-awaited moment is here: Version 2 arrived on these shores. For the last two weeks I have been busy using it. The best way to review a computer language implementation is to complete a large project in it. The more language features the project uses, the better, so my choice was to port into Prospero Pascal a program I wrote in Modula-2 to produce an "Elementary" Calculator (see figure below): more than 100 pages of source code, with extensive use of AES and VDI, some convoluted numerical algorithms, a lot of string handling, recursion, strongly modular structure, and what else. My intention was to drop the project if the Prospero Pascal turned out not to meet my expectation. Two weeks and a case of Guinnes later I am back with a working program and good news: this is by far the best Pascal-family language (i.e. Pascal or Modula-2) implementation I have used and not only on the Atari ST. CONTENTS OF THE PACKAGE The package contains three volumes of documentation and two diskettes with programs: integrated shell/editor, compiler, linker, symbolic debugger (I haven't used it at all, so it will not be mentioned any more), three libraries (standard, DOS and GEM), library manager, cross-referencer and a little program to check whether the distribution disk files are not corrupted. The INCLUDE files contain the declarations of types, globals and library subprograms; enclosed example programs may be also of some help. The system can be used with some inconvenience on the 520ST and a single-sided drive, but 1 megabyte of memory with one double-sided drive (or 500k with two) seem to be a much more workable solution. THE USER INTERFACE The master program in the Prospero environment is the shell/editor, P-BENCH.PRG. You can do virtually anything from within it: edit, compile (even without saving your code to disk), link and execute any other program. The shell can be configured to your liking (e.g. where to find what), and it behaves predictably. ST - 1 - ST CURRENT NOTES MARCH 1988 The editor function of the shell is, the weakest link in the package. Not that there is anything really wrong with it: it does not crash, has all the functions you would expect, and is better than the editors coming, for example, with Megamax C (v.1), TDI Modula-2, OSS Pascal (v.2), True Basic, or GFA Basic. It has, however, a flaky feeling and slow response (you let the key go and the program keeps deleting characters forever). Maybe I'm spoiled after using Tempus for the last six months? Also, I would like to see (in Pros pero's or any other package even Tempus does not have it) the possibility of redefining the key-to-function binding. Every editor I'm using has these definitions in a different way, and switching between editors becomes a painful experience. A fix for this can be provided by using a handy (though unfinished) desktop accessory, Startkey, published in the Winter issue of STart). I also miss more disk operations: while in the shell you can delete files, but you cannot copy or rename them, or check the disk space. This would be very handy, and it needs just 50-60 lines of code. After you get used to the editor, however, things become nice. You keep up to four files in the editor memory, compile, link and execute on the fly; a civilised way of doing things. The compiler and linker are slower than in OSS Pascal, but faster than in TDI Modula-2; within reasonable limits. We are talking programming, not horse racing here. Simple programs can be linked just by clicking on a menu entry; programs consisting of more segments (or modules) should use a script file, listing the segment names in a proper order. In general, I am quite pleased with the shell operation. After a while, you do not notice it and this is how things should be. MODULARITY The quality of the extended language standard was perhaps the strongest point of the original Prospero release. Strictly standard Pascal is close to useless in any serious programming, as it does not provide real modularity (separate compilation, data hiding), so from the very beginning the real-life implementations were providing extensions to the standard. Prospero Pascal allows not only for separate compilation, but also for encapsulation of procedures (by this I also understand functions in the strict Pascal meaning) into "segments", roughly equivalent to modules in Modula-2 or packages in Ada. All procedures in a segment may share "short-range global" variables, which remain invisible to the main program (or other segments) and which are not erased after returning from any procedure. The COMMON statement may be used to make them accessible from other segments, if desired. ST - 2 - ST CURRENT NOTES MARCH 1988 Of course, you have to re-declare all accessed procedures and commons in the accessing segment (as opposed to just naming them in the IMPORT list in Modula-2), but this is only a slight inconvenience and it allows for typecheating (at your own risk, please!), as e.g. passing variable-size arrays as parameters. To add this up: the modular features of Prospero Pascal fill for me at least 90% of the gap between Pascal and Modula-2 (the latter still missing a satisfactory implementation on the ST) and make the implementation a performer in developing of large programs. EXTENSIONS AND LIBRARIES For numerical applications Prospero provides the LONGREAL type (16 significant digits), with a clean function library (something TDI has been unable to provide for a year or so for their Modula-2 v.3). Pre-defined 1and 2-byte integer types (signed and unsigned) are added to the standard 4-byte integers, and passing them as parameters to procedures presents no problems. The CASE statement may have an OTHERWISE clause; it may also specify ranges instead of single constants (1..3: Do_Nothing;), as in Ada or True Basic. One extension I miss is the possibility of a clean exit from the middle of a loop (or from the middle of a procedure); again, only True Basic and Ada provide both these features, so maybe I am getting picky. String handling is as complete as it can be, with all the functions you would expect (Copy, Pos, Insert, Delete etc.), and with variable-length string type on top of it. I would be happier if I also had the number-to-string formatted conversions (as e.g. WriteW in OSS Pascal, very handy!). This omission can be, however, remedied by the use of a RAM file (and there is a standard procedure to open one). All language extensions may be disabled during compilation the compiler will then accept only strict (and almost unusable for any serious work) Standard Pascal. This may be useful in some situations (such as computer class projects); it also was necessary to achieve the compliance with the ISO Level 0 Pascal standard. ERROR HANDLING I could list many other goodies here, but let me just mention one very important thing: so-called exception (or error) handling. In case of an execution error (as when one of your routines attempts to divide something by zero), Prospero Pascal allows you to pass the control to an error handler your own procedure, which can tell the program, what to do. Thanks to just this feature I was able to cut the size of my numerical module ported from Modula-2 in half; the TDI's implementation has a similar thing, but I was never able to make it work as I wanted it to. The solution is not as convenient as the one in True Basic or Ada ST - 3 - ST CURRENT NOTES MARCH 1988 (again, you two together!), but it works just fine, and I found it more than useful. How could I live without it? GEM AND SYSTEM BINDINGS This is another significant improvement from the previous version. In principle, most of the AES and VDI routines still look very much like these in C (following the DRI conventions), but 20 or so were added to fill the most obvious needs overlooked in the C standard, or just to make things easier. The procedures also now accept "normal" Pascal strings no need to remember the null-termination. This may seem a detail, but makes a lot of difference by avoiding the unnecessary confusion. All the GEM bindings are very well documented; most with appropriate program examples. Low-level access to the GEMDOS, BIOS, XBIOS and Line A subroutines is also provided (some of the first three groups are rebound into higher-level procedures for convenience). Once again, I was very pleased with the performance of these libraries. Soon it became even boring: no more exciting uncertainty (will this work, or not?), and I still have yet to discover any problems. DOCUMENTATION Uniformly excellent. Roughly 700 nicely printed and densely packed pages in three volumes: one for GEM AES, one for GEM VDI and one for everything else. The last one (really No.1) contains the instructions on how to operate the system, details of the implementation, language reference manual (there is a separate chapter listing the Prospero extensions, so you do not have to read the whole thing), and descriptions of the Atari-specific non-GEM procedures. The GEM volumes are good enough to relegate the contents of one shelf with my GEM literature to the closet. The presentation is as good as in the OSS Pascal manual (very good by itself), but Prospero excels both in scope and in depth of coverage. The manuals are complete on one hand, straightforward and accessible without insulting the reader's intelligence on the other. This combination is not so common nowadays. NOW, WHAT IS MISSING HERE?? Writing a review without any serious complaints is no fun at all. Luckily, I have a major one here: where are the accessories? There is not a single word in the manual on how to compile and link them, although the procedure Menu_Register is provided and documented. ST - 4 - ST CURRENT NOTES MARCH 1988 All my experiments in this matter ended in more or less spectacular crashes. Either Prospero does not allow for compiling accessories, or the way to do it remains undocumented. I do not think there are any real reasons why this feature was not included in Prospero Pascal; a gap in documentation may be rather suspected. THE PC AND FORTRAN It may be hard to imagine, but some people still insist on running programs on PC-compatibles. The main (if not only) advantage of these compatibles is their compatibility with other PC-compatibles, which in turn excel in compatibility with other compatibles, etc. There is nothing really wrong with this phenomenon; after all this is a free society and there are even no laws against running programs on a dishwasher, if this is somebody's deepest desire. For those people Prospero has a version of their Pascal running under GEM (Version 1 or 2) on an IBM-PC. There seem to be very few differences between both versions (and these are both minor and documented in the manuals), so the source code should usually recompile and run without problems. For the ST programmers this could be a very interesting perspective. I have just ordered a PC version of Prospero Pascal (for work, of course); as soon as I get it, I will let you know how it works. There is also a link in another direction: the new version of Prospero Fortran on the ST, with a possibility of mixing compiled segments with Prospero Pascal (the GST assembler works fine with both, by the way). Can you imagine adding your new flashy Pascal graphics to all your old Fortran mainframe programs? THE BOTTOM LINE I am highly impressed with this product. By now it is the compiler of my choice on the ST. It is not cheap $150 list price (discounts may save you $20-$30), but well worth it. Upgrade from Version 1 ($39) is a steal. If you want to do serious programming in a civilised language on the ST, this is an obvious choice. ST - 5 - ST applications: if you sell them, or give them away, the PRL has to go along. What? To gi