Turbo Pascal version 1.0, Delphi, and "Standard" Pascal

Posted by on in Blogs
LarsD reported in a blog comment to my article "Turbo Pascal v1 and Delphi 2009 - it’s still all about Native Code!": "One thing I did not like about Turbo Pascal 1.0 for CP/M-80, was it’s incompatibility with Compas Pascal and Poly Pascal. For instance, Turbo Pascal used the 'else' keyword in case…else…end, where Compas Pascal used 'otherwise'."

So I did some further digging and here are some additional notes and links about the areas of similarities and differences between Turbo Pascal version 1.0 and "Standard" Pascal (there are several):

Looking at my copy of the original printing of the 1974 book "Jensen Wirth Pascal User Manual and Report", on page 31 - the case statement was defined not having an "else" or "otherwise" clause. The 1972 Pascal language report was revised in 1973 by Nicklaus Wirth - http://www.moorecad.com/standardpascal/The_Programming_Language_Pascal_1973.pdf

Taking a look at other editions of the Pascal language and their implementations for the case statement you can find:

  • Turbo Pascal v1.0's case statement had the "else" clause

  • BLS Pascal v1.2 had an "OTHERS:" clause in the case statement (page 16 of the BLS Programming Manual - http://www.nascomhomepage.com/pdf/BLSPAS.PDF)

  • Apple's Object Pascal, developed jointly by the Clascal team at Apple Computer and Niklaus Wirth and defined in the Object Pascal Report by Larry Tesler "Object Pascal Report" in Structured Language World 9(3) 1985 used the case "otherwise" clause (this was also implemented in Turbo Pascal for the Macintosh).


There are also two ANSI-ISO standard specifications for Pascal and Extended Pascal.  One could also look at the UCSD Pascal system implementation, Digital Research Pascal MT+, Microsoft Pascal, Free Pascal, and GNU Pascal for similarities and differences.

There were other syntax differences between Jensen-Wirth Pascal and Turbo Pascal version 1.0.  These
differences were listed in the Turbo Pascal Reference Manual. While we heard a few complaints from teachers
of college courses that used Pascal textbooks, the differences did not matter to most developers on CP/M and DOS. As Turbo Pascal became the "de-facto standard" Pascal for industry and schools, textbooks and course notes were changed and many programming books appeared for Turbo Pascal.  Here is the manual extract:
    TURBO Pascal closely follows the definition of Standard Pascal as defined by
    K. Jensen and N. Wirth in the Pascal User Manual and Report. The few and
    minor differences are described in section F.F. TURBO VS. STANDARD PASCAL
     
    The TURBO Pascal language closely follows the Standard Pascal defined by
    Jensen & Wirth in their User Manual and Report, with only minor differen-
    cies introduced for the sheer purpose of efficieny. These differencies are desc-
    ribed in the following. Notice that the extensions offered by TURBO Pascal
    are not discussed.
     
    F.1 Dynamic Variables
     
    Dynamic variables and pointers use the standard procedures New, Mark, and
    Release instead of the New and Dispose procedures suggested by Standard
    Pascal. Primarily this deviation from the standard is far more efficient in terms
    of execution speed and required support code, and secondly it offers compati-
    bility with other popular Pascal compilers (e.g. UCSD Pascal).
    The procedure New will not accept variant record specifications. This restric-
    tion, however, is easily circumvented by using the standard procedure Get-
    Mem.
     
    F.2 Recursion
     
    CP/M-80 version only: Because of the way local variables are handled dur-
    ing recursion, a variable local to a subprogram must not be passed as a var-
    parameter in recursive calls.
     
    F.3 Get and Put
     
    The standard procedures Get and Put are not implemented. Instead, the Read
    and Write procedures have been extended to handle all I/O needs. The reason
    for this is threefold: Firstly Read and Write gives much faster I/O, secondly
    variable space overhead is reduced, as file buffer variables are not required,
    and thirdly the Read and Write procedures are far more versatile and easier to
    understand that Get and Put.
     
    F.4 Goto Statements
     
    A goto statement must not leave the current block.
     
    F.5 Page Procedure
     
    The standard procedure Page is not implemented, as the CP/M operating sy-
    stem does not define a form-feed character.
     
    F.6 Packed Variables
     
    The reserved word packed has no effect in TURBO Pascal, but it is still allo-
    wed. This is because packing occurs automatically whenever possible. For the
    same reason, standard procedures Pack and Unpack are not implemented.
     
    F.7 Procedural Parameters
     
    Procedures and functions cannot be passed as parameters.

Some additional differences are also listed in the online Pascal FAQ file at
http://www.moorecad.com/standardpascal/pascalfaq.html

Keep the comments coming - I will continue to blog each day this month, post emails I receive from members of the original Turbo Pascal development team, emails I receive from developers, and post links to additional historical and technical resources.

Go Pascal! Go Delphi 2009!


About
Gold User, Rank: 1, Points: 2466
David Intersimone (known to many as David I.) is a passionate and innovative software industry veteran-often referred to as a developer icon-who extols and educates the world on Embarcadero developer tools. He shares his visions as an active member of the industry speaking circuit and is tapped as an expert source by the media. He is a long-standing champion of architects, developers and database professionals and works to ensure that their needs are folded into Embarcadero's strategic product plans. David holds a bachelor's degree in computer science from California Polytechnic State University at San Luis Obispo, California.

Comments

  • Guest
    Lars D Tuesday, 4 November 2008

    This is great - thanks :-)

    I totally forgot the restriction on loop variables, but that reminds me of one key parameter to the longevity of a programming language: It must be easy and feel natural to write efficient code. SQL fails totally in this - many programmers cannot read an SQL statement and conclude if it is efficient or not, and things like LINQ aren't much better.

  • Guest
    Primoz Gabrijelcic Tuesday, 4 November 2008

    I really like these trips to history ... Thanks for writing them!

    As you have the original documentation on hand - what was the Mark used for? I can't remember it - or maybe it didn't made it to the Turbo Pascal 3 for CP/M, which was the first TP I used (but not the first Pascal compiler - I started with HiSoft Pascal on ZX Spectrum and continued with VAX/VMS Pascal).

  • Guest
    Hallvard Vassbotn Tuesday, 4 November 2008

    IIRC, Mark and Release would be used to mark a point in the heap and then release all heap-allocated blocks (New/GetMem) since the last Mark.

    So it was a very rudimentary memory allocation system.

  • Guest
    Per Bakkendorff Wednesday, 5 November 2008

    He, he "good" old days :)
    If memory serves me, you're right, Halvard. Funny how quickly you forget all that house keeping. GetMem, FreeMem, New, Dispose, Mark and Release.
    I'm not so sure that a programmer today, want to hear how cumbersome it was to write programs those days, but I must admit that I never miss those day. I love my Delphi! :)

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: