Object Pascal

from Wikipedia, the free encyclopedia
Object Pascal
Paradigms : procedural , object-oriented
Publishing year: 1986
Designer: 2016
Developer: Apple , Niklaus Wirth , Anders Hejlsberg
Typing : strong, explicit (also implicit if desired), static
Important implementations : Embarcadero Delphi ( x86 and CLI ), Free Pascal (various architectures), Oxygene (CLI, Java ), Virtual Pascal (x86), TMT Pascal (x86), Turbo51 ( Intel 8051 )
Dialects: Free Pascal , Delphi.NET, Oxygene
Influenced by: Turbo Pascal, Simula , Smalltalk
Affected: .NET , C # , Genie , Java , Nim , C / AL

Object Pascal is a collective term for several partially compatible programming language derivatives that extend Pascal to include object-oriented programming . The best-known variant is the programming language of the Embarcadero Delphi development environment , which was developed by Borland and was sometimes called Delphi Language and is now also implemented by other development environments.


Early development at Apple

The first Object Pascal variant was created at Apple in early 1985 , when a team led by Larry Tesler, in collaboration with Pascal founder Niklaus Wirth, developed an object-oriented Pascal dialect that was necessary for the development of the MacApp development framework for Macintosh computers. It was a further development of an earlier object-oriented Pascal variant called Clascal , which was available for Lisa computers.

An Object Pascal version similar to the Apple version and largely compatible was shortly afterwards available in the THINK Pascal development environment for Macintosh computers.

Further development at Borland, Inprise, Codegear and Embarcadero

In 1986 Borland expanded its Turbo Pascal development environment for the Apple Macintosh to include object-oriented language features that were initially very similar to the Apple implementation. In 1989 a version for DOS followed with Turbo Pascal 5.5 . In 1993 Borland began developing Delphi as the successor to Turbo Pascal for Windows . In 1995 Borland released Delphi 1.0, introducing new language enhancements such as a new object model with expanded class support and more diverse visibility rules. The old object model from Apple and Turbo Pascal ("Old-Style Object Types") was and is still supported.

Over time, the language has been further developed and u. a. extended by generics and anonymous functions .

In addition to the popular Delphi, there are many other compilers for Object Pascal such as u. a. the open source projects Free Pascal and GNU Pascal . You aim to be partially compatible with Delphi, but maintain your own language definition with your own extensions. The current Free Pascal version 3.0 supports both old-style objects and the more modern class concepts introduced with Delphi.


The functionality of Object Pascal is comparable to that of C ++ , although the syntax is very different. Variables must be declared and assigned to a data type. There are classes with constructors and destructors , methods and properties. Methods can be virtual . The inheritance supports only one base class ; Interfaces enable multiple inheritance . The programmer is responsible for the memory management of objects. Strings are not affected because they are supported as an elementary data type.

Until Delphi 2005, objects were always created on the heap . This makes it possible in Delphi to pass any object to the caller as the result of a function. In other programming languages, such as B. C ++ , objects can be created in the heap as well as in the stack . Objects in the stack cannot be transferred as return value, as these are deleted together with the rest of the stack frame of the function when the function is exited. Thus a design decision was made here that relieves the Delphi programmer from deciding between heap / stack and always chooses the more flexible solution. The direct disadvantage of this technique is that the programmer has to remove the objects he has created from the memory himself. This is not necessary for objects in the stack. Since Delphi 2006, records with methods have also been supported, which can be used to create stack objects similar to C ++.

Sample program

(For Delphi and Free Pascal)

program ObjectPascalExample;

    THelloWorld = class
        procedure Greet;

procedure THelloWorld.Greet;
    Writeln('Hello, World!');

    HelloWorld: THelloWorld;            { impliziter Zeiger }
    HelloWorld := THelloWorld.Create;   { Konstruktor gibt einen Zeiger auf eine Instanz der Klasse THelloWorld zurück }

        HelloWorld.Free;                { Freigeben der Instanz }


Compilers or interpreters that support Object Pascal include: a .:

Class libraries

There are several class libraries for Object Pascal. Under Delphi, the Runtime Library (RTL) and the Visual Component Library (VCL) traditionally form the basis for development. While the former contains basic functionalities such as processing functions for character strings, the latter is a class library, especially for visual components (buttons, etc.). At times there was also the Component Library for Cross Platform (CLX) in addition to the VCL . But this was discontinued. Firemonkey , a platform-independent, vector-based component library, in contrast to the VCL, was introduced with Delphi XE2 .

Most of the functionality is based on class libraries, but other functions that are very often required are implemented directly by the compiler, e.g. B. the seamless integration of COM technology under Windows . Direct access to the Windows API is possible. There are a large number of components from other providers for a wide variety of applications. Some open source libraries and component collections have established themselves, in particular the JEDI Class Library (JCL), JEDI Visual Component Library (JVCL) and Internet Direct (Indy).

For Free Pascal / Lazarus there are equivalent libraries to RTL and VCL, which differ in their handling only in detail and are called Free Component Library FCL and Lazarus Component Library LCL.

Influence on other programming languages

Some of the elements and ideas of Object Pascal were incorporated into Microsoft's C # programming language . One of the reasons is that numerous Delphi co-developers at Borland were poached by Microsoft and were instrumental in the development of C #. Among them were the Delphi project manager Anders Hejlsberg , for whom the move to Microsoft was made palatable with a bonus in the millions, as well as Chuck Jazdzewski (Delphi Chief Architect), Corbin Dunn (developer of the Delphi IDE), Danny Thorpe (Delphi, Borland Chief Scientist), Eddie Churchill and Ramin Halviatti. Hejlsberg became head of software architecture at Microsoft, co-inventor of .NET and chief developer of C #.


  • Richard Kaiser: Object Pascal with Delphi - An introduction to object-oriented Windows programming ,
    Springer, (Reprint of 1997) Berlin 2013, ISBN 3-540-60340-9
  • Martin Pyka: DirectX 9 in Delphi , BoD, 2004, ISBN 3-8334-0835-9
  • Thomas Binzinger: Now I'm learning Delphi, The simple introduction to Object Pascal - for all versions up to and including Delphi 2006 , Markt und Technik, Munich 2006, ISBN 3-8272-4108-1
  • Walter Doberenz, Thomas Kowalski: Delphi 7 - Basics, professional knowledge, cookbook ,
    Hanser, Munich 2007, ISBN 3-446-41216-6
  • Hans-Georg Schumann: Delphi for Kids , bhv-Verlag, 4th edition 2009, ISBN 3-826-68662-4
  • Wolf-Gert Matthäus: Basic Course Programming with Delphi , Vieweg, 4th edition 2011, ISBN 3-834-81668-X
  • Chris Rolliston: Delphi XE2 Foundations , CreateSpace, 2012, ISBN 978-1-4775-5089-2
  • Nick Hodges: Coding in Delphi , Nepeta Enterprises, 2014, ISBN 978-1-941266-03-8

Web links

Wikibooks: Programming course: Delphi  - learning and teaching materials

Individual evidence

  1. Ray Lischner: Delphi nutshell in a: a desktop quick reference , 1st. Edition, O'Reilly and Associates, Sebastopol, CA 2000, ISBN 1565926595 .
  2. Borland boss: Microsoft is robbing us of our employees - Computer Week